]> diplodocus.org Git - nmh/blob - sbr/strindex.c
Fix stupid accidental dependence on a bash quirk in previous
[nmh] / sbr / strindex.c
1
2 /*
3 * strindex.c -- "unsigned" lexical index
4 *
5 * $Id$
6 *
7 * This code is Copyright (c) 2002, by the authors of nmh. See the
8 * COPYRIGHT file in the root directory of the nmh distribution for
9 * complete copyright information.
10 */
11
12 #include <h/mh.h>
13
14 int
15 stringdex (char *p1, char *p2)
16 {
17 char *p;
18
19 if (p1 == NULL || p2 == NULL)
20 return -1;
21
22 for (p = p2; *p; p++)
23 if (uprf (p, p1))
24 return (p - p2);
25
26 return -1;
27 }