Part3: remove superfluous case '?': from /usr/sbin utils

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Part3: remove superfluous case '?': from /usr/sbin utils

Benjamin Baier
Hello tech@

Part 3 for /usr/sbin
Also adjust getopt(3)'s optstring in usbdevs.c
and remove some unnecessary break;

Greetings Ben

Index: ac/ac.c
===================================================================
RCS file: /cvs/src/usr.sbin/ac/ac.c,v
retrieving revision 1.24
diff -u -p -r1.24 ac.c
--- ac/ac.c 12 Oct 2015 02:02:00 -0000 1.24
+++ ac/ac.c 8 Nov 2015 20:09:57 -0000
@@ -223,10 +223,8 @@ main(int argc, char *argv[])
  case 'w':
  fp = file(optarg);
  break;
- case '?':
  default:
  usage();
- break;
  }
  }
  if (optind < argc) {
Index: accton/accton.c
===================================================================
RCS file: /cvs/src/usr.sbin/accton/accton.c,v
retrieving revision 1.8
diff -u -p -r1.8 accton.c
--- accton/accton.c 27 Oct 2009 23:59:50 -0000 1.8
+++ accton/accton.c 8 Nov 2015 09:39:22 -0000
@@ -50,7 +50,6 @@ main(int argc, char *argv[])

  while ((ch = getopt(argc, argv, "")) != -1)
  switch(ch) {
- case '?':
  default:
  usage();
  }
Index: apmd/apmd.c
===================================================================
RCS file: /cvs/src/usr.sbin/apmd/apmd.c,v
retrieving revision 1.77
diff -u -p -r1.77 apmd.c
--- apmd/apmd.c 11 Oct 2015 20:23:49 -0000 1.77
+++ apmd/apmd.c 8 Nov 2015 09:39:22 -0000
@@ -402,7 +402,6 @@ main(int argc, char *argv[])
  doperf = PERF_MANUAL;
  setperfpolicy("high");
  break;
- case '?':
  default:
  usage();
  }
Index: dev_mkdb/dev_mkdb.c
===================================================================
RCS file: /cvs/src/usr.sbin/dev_mkdb/dev_mkdb.c,v
retrieving revision 1.15
diff -u -p -r1.15 dev_mkdb.c
--- dev_mkdb/dev_mkdb.c 16 Oct 2015 13:37:44 -0000 1.15
+++ dev_mkdb/dev_mkdb.c 8 Nov 2015 09:39:22 -0000
@@ -66,7 +66,6 @@ main(int argc, char *argv[])

  while ((ch = getopt(argc, argv, "")) != -1)
  switch(ch) {
- case '?':
  default:
  usage();
  }
Index: eeprom/main.c
===================================================================
RCS file: /cvs/src/usr.sbin/eeprom/main.c,v
retrieving revision 1.22
diff -u -p -r1.22 main.c
--- eeprom/main.c 11 Mar 2015 18:12:27 -0000 1.22
+++ eeprom/main.c 8 Nov 2015 09:39:22 -0000
@@ -145,7 +145,6 @@ main(int argc, char *argv[])
  break;
 #endif /* __sparc__ && !__sparc64__ */

- case '?':
  default:
  usage();
  }
Index: fdformat/fdformat.c
===================================================================
RCS file: /cvs/src/usr.sbin/fdformat/fdformat.c,v
retrieving revision 1.20
diff -u -p -r1.20 fdformat.c
--- fdformat/fdformat.c 18 Apr 2015 18:28:38 -0000 1.20
+++ fdformat/fdformat.c 8 Nov 2015 09:39:22 -0000
@@ -253,7 +253,7 @@ main(int argc, char *argv[])
  verify_only = 1;
  break;

- case '?': default:
+ default:
  usage();
  }

Index: hotplugd/hotplugd.c
===================================================================
RCS file: /cvs/src/usr.sbin/hotplugd/hotplugd.c,v
retrieving revision 1.12
diff -u -p -r1.12 hotplugd.c
--- hotplugd/hotplugd.c 10 Jan 2010 13:20:41 -0000 1.12
+++ hotplugd/hotplugd.c 8 Nov 2015 09:39:22 -0000
@@ -66,7 +66,6 @@ main(int argc, char *argv[])
  case 'd':
  device = optarg;
  break;
- case '?':
  default:
  usage();
  /* NOTREACHED */
Index: inetd/inetd.c
===================================================================
RCS file: /cvs/src/usr.sbin/inetd/inetd.c,v
retrieving revision 1.149
diff -u -p -r1.149 inetd.c
--- inetd/inetd.c 1 Nov 2015 19:59:28 -0000 1.149
+++ inetd/inetd.c 8 Nov 2015 09:39:22 -0000
@@ -316,7 +316,6 @@ main(int argc, char *argv[])
     optarg);
  break;
  }
- case '?':
  default:
  fprintf(stderr,
     "usage: inetd [-d] [-R rate] [configuration_file]\n");
Index: iostat/iostat.c
===================================================================
RCS file: /cvs/src/usr.sbin/iostat/iostat.c,v
retrieving revision 1.39
diff -u -p -r1.39 iostat.c
--- iostat/iostat.c 23 Oct 2015 08:21:27 -0000 1.39
+++ iostat/iostat.c 8 Nov 2015 09:39:22 -0000
@@ -150,7 +150,6 @@ main(int argc, char *argv[])
  if (errstr)
  errx(1, "interval is %s", errstr);
  break;
- case '?':
  default:
  usage();
  }
Index: lpr/lpq/lpq.c
===================================================================
RCS file: /cvs/src/usr.sbin/lpr/lpq/lpq.c,v
retrieving revision 1.22
diff -u -p -r1.22 lpq.c
--- lpr/lpq/lpq.c 9 Feb 2015 23:00:14 -0000 1.22
+++ lpr/lpq/lpq.c 8 Nov 2015 09:39:22 -0000
@@ -105,7 +105,6 @@ main(int argc, char **argv)
  if (wait_time < 30)
  warnx("warning: wait time less than 30 seconds");
  break;
- case '?':
  default:
  usage();
  }
Index: mtree/mtree.c
===================================================================
RCS file: /cvs/src/usr.sbin/mtree/mtree.c,v
retrieving revision 1.22
diff -u -p -r1.22 mtree.c
--- mtree/mtree.c 16 Jan 2015 06:40:18 -0000 1.22
+++ mtree/mtree.c 8 Nov 2015 09:39:22 -0000
@@ -123,7 +123,6 @@ main(int argc, char *argv[])
  case 'x':
  ftsoptions |= FTS_XDEV;
  break;
- case '?':
  default:
  usage();
  }
Index: netgroup_mkdb/netgroup_mkdb.c
===================================================================
RCS file: /cvs/src/usr.sbin/netgroup_mkdb/netgroup_mkdb.c,v
retrieving revision 1.20
diff -u -p -r1.20 netgroup_mkdb.c
--- netgroup_mkdb/netgroup_mkdb.c 13 Oct 2015 15:12:53 -0000 1.20
+++ netgroup_mkdb/netgroup_mkdb.c 8 Nov 2015 09:39:22 -0000
@@ -110,7 +110,6 @@ main(int argc, char *argv[])
  dbname = optarg;
  break;

- case '?':
  default:
  usage();
  }
Index: pwd_mkdb/pwd_mkdb.c
===================================================================
RCS file: /cvs/src/usr.sbin/pwd_mkdb/pwd_mkdb.c,v
retrieving revision 1.53
diff -u -p -r1.53 pwd_mkdb.c
--- pwd_mkdb/pwd_mkdb.c 5 Nov 2015 15:10:11 -0000 1.53
+++ pwd_mkdb/pwd_mkdb.c 8 Nov 2015 09:39:22 -0000
@@ -133,7 +133,6 @@ main(int argc, char **argv)
  break;
  case 'v': /* backward compatible */
  break;
- case '?':
  default:
  usage();
  }
Index: sa/main.c
===================================================================
RCS file: /cvs/src/usr.sbin/sa/main.c,v
retrieving revision 1.14
diff -u -p -r1.14 main.c
--- sa/main.c 26 Jul 2015 22:16:43 -0000 1.14
+++ sa/main.c 8 Nov 2015 09:39:22 -0000
@@ -162,7 +162,6 @@ main(int argc, char **argv)
  if (errstr)
  errx(1, "-v %s: %s", optarg, errstr);
  break;
- case '?':
  default:
  (void)fprintf(stderr,
     "usage: %s [-abcDdfijKklmnqrstu] [-v cutoff]"
Index: usbdevs/usbdevs.c
===================================================================
RCS file: /cvs/src/usr.sbin/usbdevs/usbdevs.c,v
retrieving revision 1.24
diff -u -p -r1.24 usbdevs.c
--- usbdevs/usbdevs.c 31 Mar 2015 13:38:27 -0000 1.24
+++ usbdevs/usbdevs.c 8 Nov 2015 09:39:22 -0000
@@ -187,7 +187,7 @@ main(int argc, char **argv)
  int addr = 0;
  int ncont;

- while ((ch = getopt(argc, argv, "a:df:v?")) != -1) {
+ while ((ch = getopt(argc, argv, "a:df:v")) != -1) {
  switch (ch) {
  case 'a':
  addr = strtonum(optarg, 1, USB_MAX_DEVICES, &errstr);
Index: vipw/vipw.c
===================================================================
RCS file: /cvs/src/usr.sbin/vipw/vipw.c,v
retrieving revision 1.18
diff -u -p -r1.18 vipw.c
--- vipw/vipw.c 16 Oct 2015 22:54:15 -0000 1.18
+++ vipw/vipw.c 8 Nov 2015 09:39:22 -0000
@@ -53,7 +53,6 @@ main(int argc, char *argv[])

  while ((ch = getopt(argc, argv, "")) != -1) {
  switch (ch) {
- case '?':
  default:
  usage();
  }
Index: wsconscfg/wsconscfg.c
===================================================================
RCS file: /cvs/src/usr.sbin/wsconscfg/wsconscfg.c,v
retrieving revision 1.14
diff -u -p -r1.14 wsconscfg.c
--- wsconscfg/wsconscfg.c 9 Feb 2015 23:00:15 -0000 1.14
+++ wsconscfg/wsconscfg.c 8 Nov 2015 20:06:19 -0000
@@ -104,10 +104,8 @@ main(int argc, char *argv[])
  case 'F':
  dsd.flags |= WSDISPLAY_DELSCR_FORCE;
  break;
- case '?':
  default:
  usage();
- break;
  }
  }
  argc -= optind;
Index: wsfontload/wsfontload.c
===================================================================
RCS file: /cvs/src/usr.sbin/wsfontload/wsfontload.c,v
retrieving revision 1.16
diff -u -p -r1.16 wsfontload.c
--- wsfontload/wsfontload.c 6 Sep 2015 20:07:46 -0000 1.16
+++ wsfontload/wsfontload.c 8 Nov 2015 20:06:46 -0000
@@ -130,10 +130,8 @@ main(int argc, char *argv[])
  case 'B':
  f.byteorder = WSDISPLAY_FONTORDER_R2L;
  break;
- case '?':
  default:
  usage();
- break;
  }
  }
  argc -= optind;