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