Remove RCS keywords, since they no longer work after git migration.
[mmh] / sbr / uprf.c
1
2 /*
3  * uprf.c -- "unsigned" lexical prefix
4  *
5  * This code is Copyright (c) 2002, by the authors of nmh.  See the
6  * COPYRIGHT file in the root directory of the nmh distribution for
7  * complete copyright information.
8  */
9
10 #include <h/mh.h>
11
12 #define TO_LOWER 040
13 #define NO_MASK  000
14
15
16 int
17 uprf (char *c1, char *c2)
18 {
19     int c, mask;
20
21     if (!(c1 && c2))
22         return 0;
23
24     while ((c = *c2++))
25     {
26 #ifdef LOCALE
27         c &= 0xff;
28         mask = *c1 & 0xff;
29         c = (isalpha(c) && isupper(c)) ? tolower(c) : c;
30         mask = (isalpha(mask) && isupper(mask)) ? tolower(mask) : mask;
31         if (c != mask)
32 #else
33         mask = (isalpha(c) && isalpha(*c1)) ?  TO_LOWER : NO_MASK;
34         if ((c | mask) != (*c1 | mask))
35 #endif
36             return 0;
37         else
38             c1++;
39     }
40     return 1;
41 }