Removed the non-LOCALE character code and the #ifdefs and simplified.
[mmh] / sbr / fmt_scan.c
index 4f9bce0..2c16dfe 100644 (file)
@@ -57,32 +57,17 @@ match(char *str, char *sub)
        int c1, c2;
        char *s1, *s2;
 
-#ifdef LOCALE
        while ((c1 = *sub)) {
-               c1 = (isalpha(c1) && isupper(c1)) ? tolower(c1) : c1;
-               while ((c2 = *str++) && c1 != ((isalpha(c2) && isupper(c2)) ? tolower(c2) : c2))
+               while ((c2 = *str++) && tolower(c1) != tolower(c2))
                        ;
                if (! c2)
                        return 0;
                s1 = sub + 1; s2 = str;
-               while ((c1 = *s1++) && ((isalpha(c1) && isupper(c1)) ? tolower(c1) : c1) == ((isalpha(c2 =*s2++) && isupper(c2)) ? tolower(c2) : c2))
+               while ((c1 = *s1++) && tolower(c1) == tolower(*s2++))
                        ;
                if (! c1)
                        return 1;
        }
-#else
-       while ((c1 = *sub)) {
-               while ((c2 = *str++) && (c1 | 040) != (c2 | 040))
-                       ;
-               if (! c2)
-                       return 0;
-               s1 = sub + 1; s2 = str;
-               while ((c1 = *s1++) && (c1 | 040) == (*s2++ | 040))
-                       ;
-               if (! c1)
-                       return 1;
-       }
-#endif
        return 1;
 }
 
@@ -217,12 +202,7 @@ cpstripped(char **start, char *end, char *str)
                return;
 
        /* skip any initial control characters or spaces */
-       while ((c = (unsigned char) *s) &&
-#ifdef LOCALE
-                       (iscntrl(c) || isspace(c)))
-#else
-                       (c <= 32))
-#endif
+       while ((c = (unsigned char) *s) && (iscntrl(c) || isspace(c)))
                s++;
 
        /* compact repeated control characters and spaces into a single space */
@@ -231,11 +211,7 @@ cpstripped(char **start, char *end, char *str)
                        *(*start)++ = c;
                else {
                        while ((c = (unsigned char) *s) &&
-#ifdef LOCALE
-                               (iscntrl(c) || isspace(c)))
-#else
-                               (c <= 32))
-#endif
+                                       (iscntrl(c) || isspace(c)))
                                s++;
                        *(*start)++ = ' ';
                }