aboutsummaryrefslogtreecommitdiff
path: root/src/strings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings.c')
-rw-r--r--src/strings.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/strings.c b/src/strings.c
index 52f81b5..e50daeb 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -485,3 +485,21 @@ int isquoted(char *sptr) {
}
return 1;
}
+
+/**
+ * Determine whether the input character is a relational operator
+ * Note: `~` is non-standard
+ * @param ch
+ * @return 0=no, 1=yes
+ */
+int isrelational(char ch) {
+ char symbols[] = "~!=<>";
+ char *symbol = symbols;
+ while (*symbol != '\0') {
+ if (ch == *symbol) {
+ return 1;
+ }
+ symbol++;
+ }
+ return 0;
+}