aboutsummaryrefslogtreecommitdiffstats
path: root/util/argparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/argparse.c')
-rw-r--r--util/argparse.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/util/argparse.c b/util/argparse.c
index 96d4c2d51..8d54de9da 100644
--- a/util/argparse.c
+++ b/util/argparse.c
@@ -273,10 +273,12 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno,
arg->r_opt = -arg->r_opt;
if( !opts[idx].short_opt ) /* unknown command/option */
arg->r_opt = (opts[idx].flags & 256)? -7:-2;
- else if( (opts[idx].flags & 8) ) /* no argument */
- arg->r_opt = -3; /* error */
- else /* no or optional argument */
+ else if( !(opts[idx].flags & 7) ) /* does not take an arg */
arg->r_type = 0; /* okay */
+ else if( (opts[idx].flags & 8) ) /* argument is optional */
+ arg->r_type = 0; /* okay */
+ else /* required argument */
+ arg->r_opt = -3; /* error */
break;
}
else if( state == 3 ) { /* no argument found */