]> diplodocus.org Git - nmh/blob - sbr/uprf.c
new.c: Order two return statements to match comment.
[nmh] / sbr / uprf.c
1 /* uprf.c -- "unsigned" lexical prefix
2 *
3 * This code is Copyright (c) 2002, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
6 */
7
8 #include <h/mh.h>
9
10
11 /* uprf returns true if s starts with prefix, ignoring case.
12 * Otherwise false. If s or prefix are NULL then false results. */
13 int
14 uprf(const char *s, const char *prefix)
15 {
16 unsigned char *us, *up;
17
18 if (!s || !prefix)
19 return 0;
20 us = (unsigned char *)s;
21 up = (unsigned char *)prefix;
22
23 while (*us && tolower(*us) == tolower(*up)) {
24 us++;
25 up++;
26 }
27
28 return *up == '\0';
29 }