]> diplodocus.org Git - nmh/blob - sbr/uprf.c
Alter mh-chart(7)'s NAME to be lowercase.
[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 /* uprf returns true if s starts with prefix, ignoring case.
14 * Otherwise false. If s or prefix are NULL then false results. */
15 int
16 uprf(const char *s, const char *prefix)
17 {
18 unsigned char *us, *up;
19
20 if (!s || !prefix)
21 return 0;
22 us = (unsigned char *)s;
23 up = (unsigned char *)prefix;
24
25 while (*us && tolower(*us) == tolower(*up)) {
26 us++;
27 up++;
28 }
29
30 return *up == '\0';
31 }