]> diplodocus.org Git - nmh/blob - sbr/strindex.c
8eaf6c22883c81d0598c916a43affd65d74e3b59
[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 #include "uprf.h"
10
11 int
12 stringdex (char *p1, char *p2)
13 {
14 char *p;
15
16 if (p1 == NULL || p2 == NULL)
17 return -1;
18
19 for (p = p2; *p; p++)
20 if (uprf (p, p1))
21 return p - p2;
22
23 return -1;
24 }