From 5be3d67ced51236cb4e370d8ea755d905a905e1d Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 13 Jun 2023 21:01:15 +0100 Subject: util/spkmodem-recv: simplify getopt handling Signed-off-by: Leah Rowe --- util/spkmodem_recv/spkmodem-recv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/util/spkmodem_recv/spkmodem-recv.c b/util/spkmodem_recv/spkmodem-recv.c index 16115bd0..b8e28a46 100644 --- a/util/spkmodem_recv/spkmodem-recv.c +++ b/util/spkmodem_recv/spkmodem-recv.c @@ -57,11 +57,9 @@ main(int argc, char *argv[]) if (pledge("stdio", NULL) == -1) err(ERR(), "pledge"); #endif - while ((c = getopt(argc, argv, "d")) != -1) { - if (c != 'd') + while ((c = getopt(argc, argv, "d")) != -1) + if (!(debug = (c == 'd'))) err(errno = EINVAL, NULL); - debug = 1; - } setvbuf(stdout, NULL, _IONBF, 0); while (!feof(stdin)) handle_audio(); -- cgit v1.2.1