diff options
Diffstat (limited to 'usr.bin/make')
-rw-r--r-- | usr.bin/make/extern.h | 3 | ||||
-rw-r--r-- | usr.bin/make/job.c | 8 | ||||
-rw-r--r-- | usr.bin/make/nonints.h | 3 | ||||
-rw-r--r-- | usr.bin/make/str.c | 42 | ||||
-rw-r--r-- | usr.bin/make/util.c | 34 | ||||
-rw-r--r-- | usr.bin/make/var.c | 6 |
6 files changed, 43 insertions, 53 deletions
diff --git a/usr.bin/make/extern.h b/usr.bin/make/extern.h index f184ce5515d..a4a0af111ea 100644 --- a/usr.bin/make/extern.h +++ b/usr.bin/make/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.8 1999/11/11 11:33:02 espie Exp $ */ +/* $OpenBSD: extern.h,v 1.9 1999/11/11 11:35:17 espie Exp $ */ /* $NetBSD: nonints.h,v 1.12 1996/11/06 17:59:19 christos Exp $ */ /*- @@ -108,7 +108,6 @@ void str_init __P((void)); void str_end __P((void)); char *str_concat __P((char *, char *, int)); char **brk_string __P((char *, int *, Boolean, char **)); -char *Str_FindSubstring __P((char *, char *)); int Str_Match __P((char *, char *)); char *Str_SYSVMatch __P((char *, char *, int *len)); void Str_SYSVSubst __P((Buffer, char *, char *, int)); diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 40c42882ae8..f7973c28432 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.13 1999/10/05 22:06:24 espie Exp $ */ +/* $OpenBSD: job.c,v 1.14 1999/11/11 11:35:17 espie Exp $ */ /* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: job.c,v 1.13 1999/10/05 22:06:24 espie Exp $"; +static char rcsid[] = "$OpenBSD: job.c,v 1.14 1999/11/11 11:35:17 espie Exp $"; #endif #endif /* not lint */ @@ -1970,7 +1970,7 @@ JobOutput(job, cp, endp, msg) register char *ecp; if (commandShell->noPrint) { - ecp = Str_FindSubstring(cp, commandShell->noPrint); + ecp = strstr(cp, commandShell->noPrint); while (ecp != NULL) { if (cp != ecp) { *ecp = '\0'; @@ -1998,7 +1998,7 @@ JobOutput(job, cp, endp, msg) while (*cp == ' ' || *cp == '\t' || *cp == '\n') { cp++; } - ecp = Str_FindSubstring(cp, commandShell->noPrint); + ecp = strstr(cp, commandShell->noPrint); } else { return cp; } diff --git a/usr.bin/make/nonints.h b/usr.bin/make/nonints.h index 35d42dea9f0..5129247dc02 100644 --- a/usr.bin/make/nonints.h +++ b/usr.bin/make/nonints.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nonints.h,v 1.8 1999/11/11 11:33:02 espie Exp $ */ +/* $OpenBSD: nonints.h,v 1.9 1999/11/11 11:35:17 espie Exp $ */ /* $NetBSD: nonints.h,v 1.12 1996/11/06 17:59:19 christos Exp $ */ /*- @@ -108,7 +108,6 @@ void str_init __P((void)); void str_end __P((void)); char *str_concat __P((char *, char *, int)); char **brk_string __P((char *, int *, Boolean, char **)); -char *Str_FindSubstring __P((char *, char *)); int Str_Match __P((char *, char *)); char *Str_SYSVMatch __P((char *, char *, int *len)); void Str_SYSVSubst __P((Buffer, char *, char *, int)); diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c index 2d2eece77bc..fe78543d41a 100644 --- a/usr.bin/make/str.c +++ b/usr.bin/make/str.c @@ -1,4 +1,4 @@ -/* $OpenBSD: str.c,v 1.7 1998/12/05 00:06:29 espie Exp $ */ +/* $OpenBSD: str.c,v 1.8 1999/11/11 11:35:17 espie Exp $ */ /* $NetBSD: str.c,v 1.13 1996/11/06 17:59:23 christos Exp $ */ /*- @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90"; #else -static char rcsid[] = "$OpenBSD: str.c,v 1.7 1998/12/05 00:06:29 espie Exp $"; +static char rcsid[] = "$OpenBSD: str.c,v 1.8 1999/11/11 11:35:17 espie Exp $"; #endif #endif /* not lint */ @@ -226,44 +226,6 @@ done: argv[argc] = (char *)NULL; } /* - * Str_FindSubstring -- See if a string contains a particular substring. - * - * Results: If string contains substring, the return value is the location of - * the first matching instance of substring in string. If string doesn't - * contain substring, the return value is NULL. Matching is done on an exact - * character-for-character basis with no wildcards or special characters. - * - * Side effects: None. - */ -char * -Str_FindSubstring(string, substring) - register char *string; /* String to search. */ - char *substring; /* Substring to find in string */ -{ - register 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(string); - if (*a++ != *b++) - break; - } - b = substring; - } - return((char *) NULL); -} - -/* * Str_Match -- * * See if a particular string matches a particular pattern. 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 diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index bc19a93b9cd..6fae0f1b9bb 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -1,4 +1,4 @@ -/* $OpenBSD: var.c,v 1.14 1999/11/10 14:11:49 espie Exp $ */ +/* $OpenBSD: var.c,v 1.15 1999/11/11 11:35:17 espie Exp $ */ /* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: var.c,v 1.14 1999/11/10 14:11:49 espie Exp $"; +static char rcsid[] = "$OpenBSD: var.c,v 1.15 1999/11/11 11:35:17 espie Exp $"; #endif #endif /* not lint */ @@ -1089,7 +1089,7 @@ VarSubstitute (word, addSpace, buf, patternp) done = FALSE; origSize = Buf_Size(buf); while (!done) { - cp = Str_FindSubstring(word, pattern->lhs); + cp = strstr(word, pattern->lhs); if (cp != (char *)NULL) { if (addSpace && (((cp - word) + pattern->rightLen) != 0)){ Buf_AddByte(buf, (Byte)' '); |