mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-06 01:40:28 +00:00
literally means no path search
Unlike loader.c, we need AccessCommand to handle the `.ape` indirection. So FindCommand stays.
This commit is contained in:
parent
2e3668b430
commit
57435d0283
1 changed files with 4 additions and 8 deletions
12
ape/ape-m1.c
12
ape/ape-m1.c
|
@ -361,12 +361,8 @@ static char FindCommand(struct PathSearcher *ps) {
|
|||
ps->path[0] = 0;
|
||||
|
||||
/* paths are always 100% taken literally when a slash exists
|
||||
$ ape foo/bar.com arg1 arg2 */
|
||||
if (memchr(ps->name, '/', ps->namelen)) {
|
||||
return AccessCommand(ps, 0);
|
||||
}
|
||||
|
||||
/* we don't run files in the current directory
|
||||
$ ape foo/bar.com arg1 arg2
|
||||
we don't run files in the current directory
|
||||
$ ape foo.com arg1 arg2
|
||||
unless $PATH has an empty string entry, e.g.
|
||||
$ expert PATH=":/bin"
|
||||
|
@ -374,8 +370,8 @@ static char FindCommand(struct PathSearcher *ps) {
|
|||
however we will execute this
|
||||
$ ape - foo.com foo.com arg1 arg2
|
||||
because cosmo's execve needs it */
|
||||
if (ps->literally && AccessCommand(ps, 0)) {
|
||||
return 1;
|
||||
if (ps->literally || memchr(ps->name, '/', ps->namelen)) {
|
||||
return AccessCommand(ps, 0);
|
||||
}
|
||||
|
||||
/* otherwise search for name on $PATH */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue