diff options
| -rw-r--r-- | src/misc/getopt.c | 7 | 
1 files changed, 5 insertions, 2 deletions
diff --git a/src/misc/getopt.c b/src/misc/getopt.c index f1a1639c..8a2e4d50 100644 --- a/src/misc/getopt.c +++ b/src/misc/getopt.c @@ -65,8 +65,11 @@ int getopt(int argc, char * const argv[], const char *optstring)  			}  			return '?';  		} -		optarg = argv[optind++] + optpos; -		optpos = 0; +		if (optstring[i+2] == ':') optarg = 0; +		if (optstring[i+2] != ':' || optpos) { +			optarg = argv[optind++] + optpos; +			optpos = 0; +		}  	}  	return c;  }  | 
