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++; __progname++;
#endif #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) { switch(choice) {
case '4': case '4':
nameserv_family = AF_INET; nameserv_family = AF_INET;
@ -220,6 +220,9 @@ int main(int argc, char **argv)
case 'u': case 'u':
username = optarg; username = optarg;
break; break;
case 'S':
forward_v6 = 1;
break;
case 't': case 't':
newroot = optarg; newroot = optarg;
break; break;
@ -271,9 +274,6 @@ int main(int argc, char **argv)
if (!lazymode) if (!lazymode)
selecttimeout = 1; selecttimeout = 1;
break; break;
case 'S':
forward_v6 = 1;
break;
case 'I': case 'I':
selecttimeout = atoi(optarg); selecttimeout = atoi(optarg);
if (selecttimeout < 1) if (selecttimeout < 1)

View File

@ -2451,7 +2451,7 @@ main(int argc, char **argv)
srand(time(NULL)); srand(time(NULL));
fw_query_init(); 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) { switch(choice) {
case '4': case '4':
addrfamily = AF_INET; addrfamily = AF_INET;