bugfix to shift non-variable options to end of list in getopt()

This commit is contained in:
chris hellberg 2021-12-30 20:44:26 -05:00
parent 883ef8ba57
commit 461c4c3a41
2 changed files with 5 additions and 5 deletions

View File

@ -195,7 +195,7 @@ int main(int argc, char **argv)
__progname++;
#endif
while ((choice = getopt(argc, argv, "46vfhruS:t:d:R:P:m:M:F:T:O:L:I")) != -1) {
while ((choice = getopt(argc, argv, "t:d:R:P:m:M:z:F:T:O:L:I:46vfhruS")) != -1) {
switch(choice) {
case '4':
nameserv_family = AF_INET;
@ -220,6 +220,9 @@ int main(int argc, char **argv)
case 'u':
username = optarg;
break;
case 'S':
forward_v6 = 1;
break;
case 't':
newroot = optarg;
break;
@ -271,9 +274,6 @@ int main(int argc, char **argv)
if (!lazymode)
selecttimeout = 1;
break;
case 'S':
forward_v6 = 1;
break;
case 'I':
selecttimeout = atoi(optarg);
if (selecttimeout < 1)

View File

@ -2451,7 +2451,7 @@ main(int argc, char **argv)
srand(time(NULL));
fw_query_init();
while ((choice = getopt(argc, argv, "46vcsSfhDu:t:d:m:l:L:p:n:b:P:z:F:i:")) != -1) {
while ((choice = getopt(argc, argv, "t:d:m:l:L:p:n:b:P:z:F:i:46vcsSfhDu")) != -1) {
switch(choice) {
case '4':
addrfamily = AF_INET;