diff options
author | Marc Espie <espie@cvs.openbsd.org> | 1999-11-11 11:35:18 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 1999-11-11 11:35:18 +0000 |
commit | 6bbddc87206dc710e0a1eed2c5a5860575a4c099 (patch) | |
tree | 5e9cf17c9daef0f6ddec46de1dba73495ac6c63d /usr.bin/make/util.c | |
parent | 0c4c42a4181f159602f546a970a388daedba6228 (diff) |
Kill Str_FindSubString, it's strstr.
Diffstat (limited to 'usr.bin/make/util.c')
-rw-r--r-- | usr.bin/make/util.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/usr.bin/make/util.c b/usr.bin/make/util.c index 410f90c7d4f..2cb48a7603a 100644 --- a/usr.bin/make/util.c +++ b/usr.bin/make/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.10 1998/12/20 23:38:11 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.11 1999/11/11 11:35:17 espie Exp $ */ /* $NetBSD: util.c,v 1.10 1996/12/31 17:56:04 christos Exp $ */ /* @@ -6,7 +6,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: util.c,v 1.10 1998/12/20 23:38:11 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: util.c,v 1.11 1999/11/11 11:35:17 espie Exp $"; #endif #include <stdio.h> @@ -420,3 +420,33 @@ snprintf(va_alist) return rv; } #endif + +#ifdef NEED_STRSTR +char * +strstr(string, substring) + const char *string; /* String to search. */ + const char *substring; /* Substring to find in string */ +{ + const char *a, *b; + + /* + * First scan quickly through the two strings looking for a single- + * character match. When it's found, then compare the rest of the + * substring. + */ + + for (b = substring; *string != 0; string += 1) { + if (*string != *b) + continue; + a = string; + for (;;) { + if (*b == 0) + return (char *)string; + if (*a++ != *b++) + break; + } + b = substring; + } + return NULL; +} +#endif |