summaryrefslogtreecommitdiff
path: root/src/misc/getopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc/getopt.c')
-rw-r--r--src/misc/getopt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/misc/getopt.c b/src/misc/getopt.c
index c3f66995..b02b81c3 100644
--- a/src/misc/getopt.c
+++ b/src/misc/getopt.c
@@ -87,7 +87,8 @@ int getopt(int argc, char * const argv[], const char *optstring)
if (optstring[i] == ':') {
optarg = 0;
if (optstring[i+1] != ':' || optpos) {
- optarg = argv[optind++] + optpos;
+ optarg = argv[optind++];
+ if (optpos) optarg += optpos;
optpos = 0;
}
if (optind > argc) {