Deleted Added
full compact
strstr.c (89857) strstr.c (130561)
1/* Simple implementation of strstr for systems without it.
2 This function is in the public domain. */
3
4/*
5
6@deftypefn Supplemental char* strstr (const char *@var{string}, const char *@var{sub})
7
8This function searches for the substring @var{sub} in the string

--- 13 unchanged lines hidden (view full) ---

22
23char *
24strstr (s1, s2)
25 char *s1, *s2;
26{
27 register char *p = s1;
28 extern char *strchr ();
29 extern int strncmp ();
1/* Simple implementation of strstr for systems without it.
2 This function is in the public domain. */
3
4/*
5
6@deftypefn Supplemental char* strstr (const char *@var{string}, const char *@var{sub})
7
8This function searches for the substring @var{sub} in the string

--- 13 unchanged lines hidden (view full) ---

22
23char *
24strstr (s1, s2)
25 char *s1, *s2;
26{
27 register char *p = s1;
28 extern char *strchr ();
29 extern int strncmp ();
30#if __GNUC__==2
31 extern __SIZE_TYPE__ strlen ();
30#if __GNUC__ >= 2
31 extern __SIZE_TYPE__ strlen (const char *);
32#endif
33 register int len = strlen (s2);
34
35 for (; (p = strchr (p, *s2)) != 0; p++)
36 {
37 if (strncmp (p, s2, len) == 0)
38 {
39 return (p);
40 }
41 }
42 return (0);
43}
32#endif
33 register int len = strlen (s2);
34
35 for (; (p = strchr (p, *s2)) != 0; p++)
36 {
37 if (strncmp (p, s2, len) == 0)
38 {
39 return (p);
40 }
41 }
42 return (0);
43}