gawk

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

commit 6a736a4f6e86cd193617740f46d21cbfa8bec59c
parent 6b5020147b2463f76edc94b6035ea3b6373f1a22
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Sun, 20 Dec 2020 20:09:42 -0800

Display error if too many arguments are given to `p` command

Diffstat:
Mmain.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/main.c b/main.c @@ -305,9 +305,7 @@ efmt(int (*putter)(const char *, int, const char **), const char *path, int argc case 0: if (pipedup(fds[1], STDOUT_FILENO, fds) != 0) _exit(1); - if (putter(path, argc, argv) != 0) - _exit(1); - _exit(0); + _exit(putter(path, argc, argv)); } for (i = 0; i < 2; ++i) @@ -411,6 +409,8 @@ execute(int command, int argc, const char **argv, int depth, const char *cache, goto too_many_args; return depth; case 'p': + if (argc > 2) + goto too_many_args; efmt(cmatch, cache, argc, argv); return 0; case 'b':