]> diplodocus.org Git - nmh/blob - sbr/uprf.c
Another pass at cleaning up (some of) the manpages.
[nmh] / 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
13 int
14 uprf (const char *c1, const char *c2)
15 {
16 int c, mask;
17
18 if (!(c1 && c2))
19 return 0;
20
21 while ((c = *c2++))
22 {
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 return 0;
29 else
30 c1++;
31 }
32 return 1;
33 }