chip@UUNET.UU.NET (Chip Salzenberg) (02/07/90)
Bash 1.04 correctly interprets a PATH of ":/bin:/usr/bin" to mean "search the currect directory first." However, it does not correctly interpret "/bin:/usr/bin:" which is supposed to mean "search the current directory last." This patch fixes the bug. Note that this bug affects CDPATH as well, and this patch fixes it too. Index: execute_cmd.c *************** *** 1537,1547 **** int i, start; ! i = start = *index; ! if ((i >= strlen (string)) || !string) return ((char *)NULL); ! while (string[i] && string[i] != ':') i++; if (i == start) { - if (!string[i]) return ((char *)NULL); - (*index)++; return (savestring ("")); } else { --- 1537,1551 ---- int i, start; ! i = *index; ! if ((i >= strlen (string)) || !string) ! return ((char *)NULL); ! if (string[i] == ':') ! i++; ! start = i; ! while (string[i] && string[i] != ':') ! i++; ! *index = i; if (i == start) { return (savestring ("")); } else { *************** *** 1549,1554 **** strncpy (value, &string[start], (i - start)); value [i - start] = '\0'; - if (string[i]) ++i; - *index = i; return (value); } --- 1553,1556 ---- -- Chip Salzenberg at ComDev/TCT <chip%tct@ateng.com>, <uunet!ateng!tct!chip>