gawk

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

commit a413191f30c58f6d72a696819ee63f94c95c936e
parent 8dc7569cf03b1821d76fc5aee916152536fc995b
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Mon, 21 Dec 2020 14:40:20 -0800

Attend to NOTE comments

exfmt()'s unchecked close() errors are now handled.

I have decided against using a struct because the only reason to
use it would be to save typing which isn't a very good one for just
a few variables.

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

diff --git a/main.c b/main.c @@ -327,8 +327,10 @@ exfmt(int (*putter)(const char *, int, const char **), const char *path, int arg _exit(putter(path, argc, argv)); } - close(fds[0]); /* NOTE: errors not checked */ - close(fds[1]); + if (close(fds[0]) || close(fds[1])) { + warn("%s: unable to close pipe", __func__); + return 1; + } for (i = 0; i < 2; ++i) if (wait(0) == -1) { warn("unable to wait"); @@ -553,10 +555,6 @@ gawk(int depth, const char *tmpdir, const char *host, const char *path, const ch if (argc < 0) { warnc(E2BIG, "'%c'", *start); } else { - /* NOTE: I'v been avoiding it but - * I think a struct would be more - * than appropriate. - */ done = execute(*start, argc, (const char **)argv, depth, cache, tmpdir,