sacc

sacc (saccomys): simple gopher client.
Log | Files | Refs | LICENSE

commit e5ffdd3e259aafb40e46381e1093c942b5a91757
parent 59f8f128f4fd5d7ec4efd6466da6c238cce9e2f9
Author: Quentin Rameau <quinq@fifth.space>
Date:   Sun, 27 Aug 2017 13:26:31 +0200

Hide plumber output to prevent display cluttering

Diffstat:
sacc.c | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/sacc.c b/sacc.c @@ -25,6 +25,7 @@ static char *mainurl; static Item *mainentry; +static int devnullfd; static int parent = 1; void @@ -480,6 +481,8 @@ plumb(char *url) return; case 0: parent = 0; + dup2(devnullfd, 1); + dup2(devnullfd, 2); if (execlp(plumber, plumber, url, NULL) < 0) uistatus("execlp: plumb(%s): %s", url, strerror(errno)); } @@ -743,6 +746,8 @@ setup(void) { setenv("PAGER", "more", 0); atexit(cleanup); + if ((devnullfd = open("/dev/null", O_WRONLY)) < 0) + die("open: /dev/null: %s", strerror(errno)); if (mkdir("/tmp/sacc", S_IRWXU) < 0 && errno != EEXIST) die("mkdir: %s: %s", "/tmp/sacc", errno); uisetup();