3 |
|
|
4 |
/* |
/* |
5 |
|
|
6 |
NAME |
@deftypefn Supplemental char* strstr (const char *@var{string}, const char *@var{sub}) |
7 |
|
|
8 |
strstr -- locate first occurance of a substring |
This function searches for the substring @var{sub} in the string |
9 |
|
@var{string}, not including the terminating null characters. A pointer |
10 |
|
to the first occurrence of @var{sub} is returned, or @code{NULL} if the |
11 |
|
substring is absent. If @var{sub} points to a string with zero |
12 |
|
length, the function returns @var{string}. |
13 |
|
|
14 |
SYNOPSIS |
@end deftypefn |
15 |
|
|
|
#include <string.h> |
|
|
|
|
|
char *strstr (char *s1, char *s2) |
|
|
|
|
|
DESCRIPTION |
|
|
|
|
|
Locates the first occurance in the string pointed to by S1 of |
|
|
the string pointed to by S2. Returns a pointer to the substring |
|
|
found, or a NULL pointer if not found. If S2 points to a string |
|
|
with zero length, the function returns S1. |
|
|
|
|
|
BUGS |
|
16 |
|
|
17 |
*/ |
*/ |
18 |
|
|
27 |
register char *p = s1; |
register char *p = s1; |
28 |
extern char *strchr (); |
extern char *strchr (); |
29 |
extern int strncmp (); |
extern int strncmp (); |
30 |
#if __GNUC__==2 |
#if __GNUC__ >= 2 |
31 |
extern __SIZE_TYPE__ strlen (); |
extern __SIZE_TYPE__ strlen (const char *); |
32 |
#endif |
#endif |
33 |
register int len = strlen (s2); |
register int len = strlen (s2); |
34 |
|
|