0
|
1 /* uprf.c - "unsigned" lexical prefix */
|
|
2 #ifndef lint
|
12
|
3 static char ident[] = "@(#)$Id: uprf.c,v 1.1.1.1 2005/04/18 14:46:06 kono Exp $";
|
0
|
4 #endif /* lint */
|
|
5
|
|
6 #define TO_LOWER 040
|
|
7 #define NO_MASK 000
|
|
8 #include <ctype.h>
|
|
9
|
|
10 uprf (c1, c2)
|
|
11 register char *c1,
|
|
12 *c2;
|
|
13 {
|
|
14 register int c,
|
|
15 mask;
|
|
16
|
|
17 if (c1 == 0 || c2 == 0)
|
|
18 return(0); /* XXX */
|
|
19
|
|
20 while (c = *c2++)
|
|
21 {
|
|
22 #ifdef LOCALE
|
|
23 c &= 0xff;
|
|
24 mask = *c1 & 0xff;
|
|
25 c = (isalpha(c) && isupper(c)) ? tolower(c) : c;
|
|
26 mask = (isalpha(mask) && isupper(mask)) ? tolower(mask) : mask;
|
|
27 if (c != mask)
|
|
28 #else
|
|
29 mask = (isalpha(c) && isalpha(*c1)) ? TO_LOWER : NO_MASK;
|
|
30 if ((c | mask) != (*c1 | mask))
|
|
31 #endif
|
|
32 return 0;
|
|
33 else
|
|
34 c1++;
|
|
35 }
|
|
36 return 1;
|
|
37 }
|