Initial revision
[mmh] / sbr / ssequal.c
1
2 /*
3  * ssequal.c -- check if a string is a substring of another
4  *
5  * $Id$
6  */
7
8 #include <h/mh.h>
9
10 /*
11  * Check if s1 is a substring of s2.
12  * If yes, then return 1, else return 0.
13  */
14
15 int
16 ssequal (char *s1, char *s2)
17 {
18     if (!s1)
19         s1 = "";
20     if (!s2)
21         s2 = "";
22
23     while (*s1)
24         if (*s1++ != *s2++)
25             return 0;
26     return 1;
27 }