]> diplodocus.org Git - nmh/blob - sbr/strindex.c
new.c: Order two return statements to match comment.
[nmh] / sbr / strindex.c
1 /* strindex.c -- "unsigned" lexical index
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 int
11 stringdex (char *p1, char *p2)
12 {
13 char *p;
14
15 if (p1 == NULL || p2 == NULL)
16 return -1;
17
18 for (p = p2; *p; p++)
19 if (uprf (p, p1))
20 return p - p2;
21
22 return -1;
23 }