source: trunk/third/nmh/sbr/uprf.c @ 12455

Revision 12455, 620 bytes checked in by danw, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r12454, which included commits to RCS files with non-trunk default branches.
Line 
1
2/*
3 * uprf.c -- "unsigned" lexical prefix
4 *
5 * $Id: uprf.c,v 1.1.1.1 1999-02-07 18:14:10 danw Exp $
6 */
7
8#include <h/mh.h>
9
10#define TO_LOWER 040
11#define NO_MASK  000
12
13
14int
15uprf (char *c1, char *c2)
16{
17    int c, mask;
18
19    if (!(c1 && c2))
20        return 0;
21
22    while ((c = *c2++))
23    {
24#ifdef LOCALE
25        c &= 0xff;
26        mask = *c1 & 0xff;
27        c = (isalpha(c) && isupper(c)) ? tolower(c) : c;
28        mask = (isalpha(mask) && isupper(mask)) ? tolower(mask) : mask;
29        if (c != mask)
30#else
31        mask = (isalpha(c) && isalpha(*c1)) ?  TO_LOWER : NO_MASK;
32        if ((c | mask) != (*c1 | mask))
33#endif
34            return 0;
35        else
36            c1++;
37    }
38    return 1;
39}
Note: See TracBrowser for help on using the repository browser.