No need to handle '-' explicitly in getopt() loop.
Obtained from: NetBSD
This commit is contained in:
parent
bcd46c600a
commit
fc7f17b1fe
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97393
@ -84,11 +84,8 @@ main(argc, argv)
|
||||
|
||||
(void) setlocale(LC_ALL, "");
|
||||
|
||||
while ((ch = getopt(argc, argv, "-123i")) != -1)
|
||||
while ((ch = getopt(argc, argv, "123i")) != -1)
|
||||
switch(ch) {
|
||||
case '-':
|
||||
--optind;
|
||||
goto done;
|
||||
case '1':
|
||||
flag1 = 0;
|
||||
break;
|
||||
@ -105,7 +102,7 @@ main(argc, argv)
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
done: argc -= optind;
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc != 2)
|
||||
|
Loading…
Reference in New Issue
Block a user