=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/str.c,v retrieving revision 1.6 retrieving revision 1.7 diff -c -r1.6 -r1.7 *** src/usr.bin/make/str.c 1998/03/07 18:34:50 1.6 --- src/usr.bin/make/str.c 1998/12/05 00:06:29 1.7 *************** *** 1,4 **** ! /* $OpenBSD: str.c,v 1.6 1998/03/07 18:34:50 millert Exp $ */ /* $NetBSD: str.c,v 1.13 1996/11/06 17:59:23 christos Exp $ */ /*- --- 1,4 ---- ! /* $OpenBSD: str.c,v 1.7 1998/12/05 00:06:29 espie Exp $ */ /* $NetBSD: str.c,v 1.13 1996/11/06 17:59:23 christos Exp $ */ /*- *************** *** 43,88 **** #if 0 static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90"; #else ! static char rcsid[] = "$OpenBSD: str.c,v 1.6 1998/03/07 18:34:50 millert Exp $"; #endif #endif /* not lint */ #include "make.h" - static char **argv, *buffer; - static int argmax, curlen; - - /* - * str_init -- - * Initialize the strings package - * - */ - void - str_init() - { - char *p1; - argv = (char **)emalloc(((argmax = 50) + 1) * sizeof(char *)); - argv[0] = Var_Value(".MAKE", VAR_GLOBAL, &p1); - } - - - /* - * str_end -- - * Cleanup the strings package - * - */ - void - str_end() - { - if (argv) { - if (argv[0]) - free(argv[0]); - free((Address) argv); - } - if (buffer) - free(buffer); - } - /*- * str_concat -- * concatenate the two strings, inserting a space or slash between them, --- 43,54 ---- #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 $"; #endif #endif /* not lint */ #include "make.h" /*- * str_concat -- * concatenate the two strings, inserting a space or slash between them, *************** *** 140,172 **** * the first word is always the value of the .MAKE variable. */ char ** ! brk_string(str, store_argc, expand) register char *str; int *store_argc; Boolean expand; { register int argc, ch; register char inquote, *p, *start, *t; int len; /* skip leading space chars. */ for (; *str == ' ' || *str == '\t'; ++str) continue; /* allocate room for a copy of the string */ ! if ((len = strlen(str) + 1) > curlen) { ! if (buffer) ! free(buffer); ! buffer = emalloc(curlen = len); ! } /* * copy the string; at the same time, parse backslashes, * quotes and build the argument list. */ ! argc = 1; inquote = '\0'; ! for (p = str, start = t = buffer;; ++p) { switch(ch = *p) { case '"': case '\'': --- 106,138 ---- * the first word is always the value of the .MAKE variable. */ char ** ! brk_string(str, store_argc, expand, buffer) register char *str; int *store_argc; Boolean expand; + char **buffer; { register int argc, ch; register char inquote, *p, *start, *t; int len; + int argmax = 50, curlen = 0; + char **argv = (char **)emalloc((argmax + 1) * sizeof(char *)); /* skip leading space chars. */ for (; *str == ' ' || *str == '\t'; ++str) continue; /* allocate room for a copy of the string */ ! if ((len = strlen(str) + 1) > curlen) ! *buffer = emalloc(curlen = len); /* * copy the string; at the same time, parse backslashes, * quotes and build the argument list. */ ! argc = 0; inquote = '\0'; ! for (p = str, start = t = *buffer;; ++p) { switch(ch = *p) { case '"': case '\'':