diff options
author | June McEnroe <june@causal.agency> | 2021-02-24 21:37:24 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-02-24 21:37:24 -0500 |
commit | dccb8a7e4f2307ed45f03c34d4395db9e5f98846 (patch) | |
tree | ff8f3a2611fe54bf6bf668f7525ade955a232744 /bin/ever.c | |
parent | Remove sbubby, etc. from plan (diff) | |
download | src-dccb8a7e4f2307ed45f03c34d4395db9e5f98846.tar.gz src-dccb8a7e4f2307ed45f03c34d4395db9e5f98846.zip |
Add -q flag to ever
Diffstat (limited to '')
-rw-r--r-- | bin/ever.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/ever.c b/bin/ever.c index 7838af4b..f8ff943b 100644 --- a/bin/ever.c +++ b/bin/ever.c @@ -45,6 +45,7 @@ static int watch(int kq, char *path) { return fd; } +static bool quiet; static void exec(int fd, char *const argv[]) { pid_t pid = fork(); if (pid < 0) err(EX_OSERR, "fork"); @@ -59,6 +60,7 @@ static void exec(int fd, char *const argv[]) { pid = wait(&status); if (pid < 0) err(EX_OSERR, "wait"); + if (quiet) return; if (WIFEXITED(status)) { warnx("exit %d\n", WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { @@ -71,9 +73,10 @@ static void exec(int fd, char *const argv[]) { int main(int argc, char *argv[]) { bool input = false; - for (int opt; 0 < (opt = getopt(argc, argv, "i"));) { + for (int opt; 0 < (opt = getopt(argc, argv, "iq"));) { switch (opt) { break; case 'i': input = true; + break; case 'q': quiet = true; break; default: return EX_USAGE; } } |