]> diplodocus.org Git - nmh/blob - sbr/ssequal.c
Fix stupid accidental dependence on a bash quirk in previous
[nmh] / sbr / ssequal.c
1
2 /*
3 * ssequal.c -- check if a string is a substring of another
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 /*
15 * Check if s1 is a substring of s2.
16 * If yes, then return 1, else return 0.
17 */
18
19 int
20 ssequal (char *s1, char *s2)
21 {
22 if (!s1)
23 s1 = "";
24 if (!s2)
25 s2 = "";
26
27 while (*s1)
28 if (*s1++ != *s2++)
29 return 0;
30 return 1;
31 }