9
0
Fork 0

hush source: expand $PATH

The behaviour of other shells suggest that with source or '.'
the path should be resolved using the PATH environment variable. Do
the same in barebox.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2012-03-06 16:40:04 +01:00
parent 3f637f7dc4
commit d94579abaf
1 changed files with 16 additions and 1 deletions

View File

@ -1678,10 +1678,25 @@ BAREBOX_CMD_END
static int do_source(int argc, char *argv[])
{
char *path;
int ret;
if (argc < 2)
return COMMAND_ERROR_USAGE;
return source_script(argv[1], argc - 1, argv + 1);
if (strchr(argv[1], '/')) {
path = xstrdup(argv[1]);
} else {
path = find_execable(argv[1]);
if (!path)
return 1;
}
ret = source_script(path, argc - 1, argv + 1);
free(path);
return ret;
}
static const char *source_aliases[] = { ".", NULL};