Removed forgotten unused variable.
[mmh] / sbr / isprefix.c
1 /*
2 ** isprefix.c -- check if a string is a PREFIX of another
3 **
4 ** This code is Copyright (c) 2002, by the authors of nmh.  See the
5 ** COPYRIGHT file in the root directory of the nmh distribution for
6 ** complete copyright information.
7 */
8
9 #include <h/mh.h>
10
11 /*
12 ** This function had been named ssequal(). It had advertised it would
13 ** check for substring matching, but actually checked prefix matching.
14 ** The latter being the thing wanted. Hence, only the name and the
15 ** descriptions were wrong. I fixed this.
16 ** -- markus schnalke <meillo@marmaro.de>, 2011-11
17 */
18
19 /*
20 ** Check if s1 is a PREFIX of s2.
21 ** If yes, then return 1, else return 0.
22 */
23 int
24 isprefix(char *s1, char *s2)
25 {
26         if (!s1)
27                 s1 = "";
28         if (!s2)
29                 s2 = "";
30
31         while (*s1)
32                 if (*s1++ != *s2++)
33                         return 0;
34         return 1;
35 }