diff --git a/lib/getopt.c b/lib/getopt.c index 0eb3a770..068ce519 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -84,6 +84,10 @@ int lib_getopt(int argc, char *const argv[], const char *optstring) /* Argument in the same argv */ optarg = &argv[optind][getopt_common.optwhere]; } + else if (*(++optspec) == ':') { + /* Optional argument */ + optarg = NULL; + } else if (optind + 1 < argc) { /* Argument in the next argv */ optarg = argv[optind + 1];