seg@smsdpg.uu.net (Scott Garfinkle) (02/20/89)
This is an official patch. Please apply it. The enclosed patch fixes the problems noted by John Thiel in the system() builtin and AWKPATH. Actually, these were the same problem. It also makes the separator inside awkpath ';' for DOS, to stay in line with the norm. If you want the source for gawk before Rahul posts it (if he does), you can uucp it from uunet, if you're connected, or ftp it from prep.ai.mit.edu (I think). I will look at the regular expression difficulties, as will Conrad (although he's unavailable for a few days). This will undoubtedly be harder to fix. -Scott E. G. *** awk3.c- Mon Feb 20 09:12:08 1989 --- awk3.c Mon Feb 20 09:11:56 1989 *************** *** 212,218 **** ENVIRON_node = spc_var("ENVIRON", Nnull_string); for (i = 0; environ[i]; i++) { ! var = environ[i]; val = index(var, '='); if (val) *val++ = '\0'; --- 212,218 ---- ENVIRON_node = spc_var("ENVIRON", Nnull_string); for (i = 0; environ[i]; i++) { ! (void) strcpy(var = malloc(strlen(environ[i])+1),environ[i]); val = index(var, '='); if (val) *val++ = '\0'; *************** *** 220,225 **** --- 220,226 ---- val = ""; aptr = assoc_lookup(ENVIRON_node, tmp_string(var, strlen (var))); *aptr = make_string(val, strlen (val)); + free(var); } } *** awk.y- Mon Feb 20 09:59:09 1989 --- awk.y Mon Feb 20 10:00:13 1989 *************** *** 1387,1401 **** awkpath = savepath; #ifdef MSDOS if (index(file,'/')!=NULL || index(file,'\\')!=NULL || index(file,':')!=NULL) #else if (index (file, '/') != NULL) /* some kind of path name, no search */ #endif return (fopen (file, "r")); do { ! for (cp = trypath; *awkpath && *awkpath != ':'; ) *cp++ = *awkpath++; *cp++ = '/'; *cp = '\0'; /* clear left over junk */ --- 1387,1403 ---- awkpath = savepath; #ifdef MSDOS + # define ENV_SEP ';' /* DOS uses semicolon to separate path entries */ if (index(file,'/')!=NULL || index(file,'\\')!=NULL || index(file,':')!=NULL) #else + # define ENV_SEP ':' if (index (file, '/') != NULL) /* some kind of path name, no search */ #endif return (fopen (file, "r")); do { ! for (cp = trypath; *awkpath && *awkpath != ENV_SEP; ) *cp++ = *awkpath++; *cp++ = '/'; *cp = '\0'; /* clear left over junk */