usr_fstring[errpos] = '\0';
for (i = errpos-errctx; i < errpos; i++) {
-#ifdef LOCALE
if (iscntrl(usr_fstring[i]))
-#else
- if (usr_fstring[i] < 32)
-#endif
usr_fstring[i] = '_';
}
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;
}
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 */
*(*start)++ = c;
else {
while ((c = (unsigned char) *s) &&
-#ifdef LOCALE
- (iscntrl(c) || isspace(c)))
-#else
- (c <= 32))
-#endif
+ (iscntrl(c) || isspace(c)))
s++;
*(*start)++ = ' ';
}
if (i == EOF)
return 0;
if (cp < &ansbuf[sizeof ansbuf - 1]) {
-#ifdef LOCALE
- i = (isalpha(i) && isupper(i)) ? tolower(i) : i;
-#else
- if (i >= 'A' && i <= 'Z')
- i += 'a' - 'A';
-#endif
- *cp++ = i;
+ *cp++ = tolower(i);
}
}
*cp = '\0';
#include <h/mh.h>
-#define TO_LOWER 040
-#define NO_MASK 000
-
int
uprf(char *c1, char *c2)
return 0;
while ((c = *c2++)) {
-#ifdef LOCALE
- c &= 0xff;
- mask = *c1 & 0xff;
- c = (isalpha(c) && isupper(c)) ? tolower(c) : c;
- mask = (isalpha(mask) && isupper(mask)) ? tolower(mask) : mask;
- if (c != mask)
-#else
- mask = (isalpha(c) && isalpha(*c1)) ? TO_LOWER : NO_MASK;
- if ((c | mask) != (*c1 | mask))
-#endif
+ if (tolower(c &= 0xff) != tolower(*c1 & 0xff))
return 0;
else
c1++;