mirror of
https://github.com/sheumann/hush.git
synced 2025-01-10 16:29:44 +00:00
Changes to support GNO-style PATH in type and source commands, and in tab completion.
This commit is contained in:
parent
4c37e05f0c
commit
6dfc5eadb3
@ -853,6 +853,12 @@ enum {
|
||||
FIND_FILE_ONLY = 2
|
||||
};
|
||||
|
||||
#ifndef __GNO__
|
||||
# define PATH_SEP ':'
|
||||
#else
|
||||
# define PATH_SEP ' '
|
||||
#endif
|
||||
|
||||
static int path_parse(char ***p)
|
||||
{
|
||||
int npth;
|
||||
@ -872,7 +878,7 @@ static int path_parse(char ***p)
|
||||
tmp = (char*)pth;
|
||||
npth = 1; /* path component count */
|
||||
while (1) {
|
||||
tmp = strchr(tmp, ':');
|
||||
tmp = strchr(tmp, PATH_SEP);
|
||||
if (!tmp)
|
||||
break;
|
||||
tmp++;
|
||||
@ -885,7 +891,7 @@ static int path_parse(char ***p)
|
||||
res[0] = tmp = xstrdup(pth);
|
||||
npth = 1;
|
||||
while (1) {
|
||||
tmp = strchr(tmp, ':');
|
||||
tmp = strchr(tmp, PATH_SEP);
|
||||
if (!tmp)
|
||||
break;
|
||||
*tmp++ = '\0'; /* ':' -> '\0' */
|
||||
|
@ -6512,6 +6512,7 @@ static void restore_redirects(int squirrel[])
|
||||
static char *find_in_path(const char *arg)
|
||||
{
|
||||
char *ret = NULL;
|
||||
#ifndef __GNO__
|
||||
const char *PATH = get_local_var_value("PATH");
|
||||
|
||||
if (!PATH)
|
||||
@ -6538,6 +6539,13 @@ static char *find_in_path(const char *arg)
|
||||
}
|
||||
PATH = end + 1;
|
||||
}
|
||||
#else
|
||||
ret = buildPath(arg);
|
||||
if (ret && access(ret, F_OK) != 0) {
|
||||
free(ret);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user