From 58332972c8ed662b36fa575355047d2de8b8f319 Mon Sep 17 00:00:00 2001 From: cheloha <> Date: Sun, 4 Dec 2022 23:50:46 +0000 Subject: userspace: remove vestigial '?' cases from top-level getopt(3) loops getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@ --- src/regress/lib/libc/db/dbtest.c | 3 +-- src/regress/lib/libc/regex/main.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/regress/lib/libc/db/dbtest.c b/src/regress/lib/libc/db/dbtest.c index fd1d2e8077..3207bafda3 100644 --- a/src/regress/lib/libc/db/dbtest.c +++ b/src/regress/lib/libc/db/dbtest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dbtest.c,v 1.20 2022/11/10 12:38:57 anton Exp $ */ +/* $OpenBSD: dbtest.c,v 1.21 2022/12/04 23:50:46 cheloha Exp $ */ /* $NetBSD: dbtest.c,v 1.8 1996/05/03 21:57:48 cgd Exp $ */ /*- @@ -107,7 +107,6 @@ main(int argc, char *argv[]) case 's': sflag = 1; break; - case '?': default: usage(); } diff --git a/src/regress/lib/libc/regex/main.c b/src/regress/lib/libc/regex/main.c index 50c3f7589e..4501e86b87 100644 --- a/src/regress/lib/libc/regex/main.c +++ b/src/regress/lib/libc/regex/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.11 2020/02/14 19:17:34 schwarze Exp $ */ +/* $OpenBSD: main.c,v 1.12 2022/12/04 23:50:46 cheloha Exp $ */ /* $NetBSD: main.c,v 1.2 1995/04/20 22:39:51 cgd Exp $ */ #include @@ -61,7 +61,6 @@ main(int argc, char *argv[]) case 'x': /* Debugging. */ debug++; break; - case '?': default: errflg++; break; -- cgit v1.2.3-55-g6feb