mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-06 18:00:28 +00:00
execfn is _ or else prog
This commit is contained in:
parent
f55d67967f
commit
d73e77d079
1 changed files with 4 additions and 4 deletions
|
@ -954,7 +954,7 @@ int main(int argc, char **argv, char **envp) {
|
|||
M->lib.dlerror = dlerror;
|
||||
|
||||
/* getenv("_") is close enough to at_execfn */
|
||||
execfn = argc > 0 ? argv[0] : 0;
|
||||
execfn = 0;
|
||||
for (i = 0; envp[i]; ++i) {
|
||||
if (envp[i][0] == '_' && envp[i][1] == '=') {
|
||||
execfn = envp[i] + 2;
|
||||
|
@ -993,9 +993,6 @@ int main(int argc, char **argv, char **envp) {
|
|||
ln -sf /usr/local/bin/ape /opt/cosmos/bin/bash.ape
|
||||
and then use #!/opt/cosmos/bin/bash.ape instead. */
|
||||
M->ps.literally = 0;
|
||||
if (!execfn) {
|
||||
execfn = prog;
|
||||
}
|
||||
argc = sp[0];
|
||||
argv = (char **)(sp + 1);
|
||||
} else if ((M->ps.literally = argc >= 3 && !StrCmp(argv[1], "-"))) {
|
||||
|
@ -1019,6 +1016,9 @@ int main(int argc, char **argv, char **envp) {
|
|||
argc = sp[1] = sp[0] - 1;
|
||||
argv = (char **)((sp += 1) + 1);
|
||||
}
|
||||
if (!execfn) {
|
||||
execfn = prog;
|
||||
}
|
||||
|
||||
/* allocate ephemeral memory for reading file */
|
||||
n = sizeof(union ElfEhdrBuf);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue