gawk

[old] Sed-like interface to the Gopher protocol
Log | Files | Refs | LICENSE

commit 5e1238ba9a97f700b05d03198873f519867a9cf8
parent 534d784209a6252c09e07c8868cdaab798727244
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Thu, 18 Feb 2021 15:43:53 -0800

Fix the extern command

It was not properly updated when the commands were given access to
their name (commit 2c622122) causing it to try and execute it's
name.

Diffstat:
Mcommand.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/command.c b/command.c @@ -79,11 +79,11 @@ cextern(int argc, char **argv, int ino, char **item) char url[MY_URL_MAX]; int i; - if (warg(1, -1, argc, argv)) + if (warg(2, -1, argc, argv)) return FAIL; snprintf(url, sizeof(url), "%s%s", item[GI_HOST], item[GI_PATH]); - for (i = 0; i < argc; ++i) + for (i = 1; i < argc; ++i) if (strcmp(argv[i], "%") == 0) argv[i] = url; @@ -92,6 +92,7 @@ cextern(int argc, char **argv, int ino, char **item) warn(errno, "unable to fork"); return FAIL; case 0: + ++argv; execvp(*argv, argv); warn(errno, "execvp '%s'", *argv); _exit(1);