Changes in the reading of qualifier(s). New function: ccl_qual_fitem.
[egate.git] / ccl / ccltoken.c
index 26a45f6..51cdf0e 100644 (file)
@@ -2,7 +2,12 @@
  * Europagate, 1995
  *
  * $Log: ccltoken.c,v $
- * Revision 1.7  1995/04/19 12:11:24  adam
+ * Revision 1.8  1995/05/11 14:03:57  adam
+ * Changes in the reading of qualifier(s). New function: ccl_qual_fitem.
+ * New variable ccl_case_sensitive, which controls whether reserved
+ * words and field names are case sensitive or not.
+ *
+ * Revision 1.7  1995/04/19  12:11:24  adam
  * Minor change.
  *
  * Revision 1.6  1995/04/17  09:31:48  adam
@@ -36,6 +41,7 @@ const char *ccl_token_and = "and";
 const char *ccl_token_or = "or";
 const char *ccl_token_not = "not andnot";
 const char *ccl_token_set = "set";
+int ccl_case_sensitive = 1;
 
 /*
  * token_cmp: Compare token with keyword(s)
@@ -52,13 +58,24 @@ static int token_cmp (const char *kw, struct ccl_token *token)
         return 0;
     while ((cp2 = strchr (cp1, ' ')))
     {
-        if (token->len == cp2-cp1 &&
-           !memcmp (cp1, token->name, token->len))
-           return 1;
+        if (token->len == cp2-cp1)
+            if (ccl_case_sensitive)
+            {
+                if (!memcmp (cp1, token->name, token->len))
+                    return 1;
+            }
+            else
+            {
+                if (!ccl_memicmp (cp1, token->name, token->len))
+                    return 1;
+            }
        cp1 = cp2+1;
     }
-    return token->len == strlen(cp1) 
-           && !memcmp (cp1, token->name, token->len);
+    if (ccl_case_sensitive)
+        return token->len == strlen(cp1) 
+            && !memcmp (cp1, token->name, token->len);
+    return token->len == strlen(cp1) &&
+        !ccl_memicmp (cp1, token->name, token->len);
 }
 
 /*