home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 4
/
DATAFILE_PDCD4.iso
/
unix
/
unixlib36d
/
src
/
c
/
strstr
< prev
next >
Wrap
Text File
|
1994-03-08
|
649b
|
36 lines
#ifdef __STDC__
static char sccs_id[] = "@(#) strstr.c 1.1 " __DATE__ " HJR";
#else
static char sccs_id[] = "@(#) strstr.c 1.1 26/9/90 HJR";
#endif
/* strstr.c (c) Copyright 1990 H.Rogers */
#ifndef __STDC__
#include "sys/types.h"
#endif
#include <string.h>
#ifdef __STDC__
char *
strstr (register const char *s1, register const char *s2)
#else
char *
strstr (s1, s2)
register const char *s1;
register const char *s2;
#endif
{
register int l1 = strlen (s1), l2 = strlen (s2);
register const char *e1 = s1 + l1 - l2;
while (s1 < e1)
{
if (!strncmp (s1, s2, l2))
return ((char *) s1);
s1++;
}
return (0);
}