Fix spelling and encoding errors in manpages and an error message
[mmh] / sbr / strindex.c
1 /*
2 ** strindex.c -- "unsigned" lexical index
3 **            -- Returns the index at which `needle' appears in `haystack' 
4 **
5 ** This code is Copyright (c) 2002, by the authors of nmh.  See the
6 ** COPYRIGHT file in the root directory of the nmh distribution for
7 ** complete copyright information.
8 */
9
10 #include <h/mh.h>
11
12 int
13 stringdex(char *needle, char *haystack)
14 {
15         char *p;
16
17         if (needle == NULL || haystack == NULL)
18                 return -1;
19
20         for (p = haystack; *p; p++)
21                 if (strncasecmp(p, needle, strlen(needle))==0)
22                         return (p - haystack);
23
24         return -1;
25 }