Browse code

shared/optparser.c: improve handling of short switches (bb#1374)

git-svn: trunk@4665

Tomasz Kojm authored on 2009/01/30 16:49:04
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Jan 30 09:13:15 CET 2009 (tk)
2
+---------------------------------
3
+ * shared/optparser.c: improve handling of short switches (bb#1374)
4
+
1 5
 Thu Jan 29 20:27:45 CET 2009 (tk)
2 6
 ---------------------------------
3 7
  * shared/optparser.c, clamconf/clamconf.c: add --generate-config
... ...
@@ -653,9 +653,11 @@ struct optstruct *optparse(const char *cfgfile, int argc, char **argv, int verbo
653 653
 			return NULL;
654 654
 		    }
655 655
 		    shortopts[sc++] = optentry->shortopt;
656
-		    shortopts[sc++] = ':';
657
-		    if(!(optentry->flags & FLAG_REQUIRED) && (optentry->argtype == TYPE_BOOL || optentry->strarg))
656
+		    if(optentry->argtype != TYPE_BOOL) {
658 657
 			shortopts[sc++] = ':';
658
+			if(!(optentry->flags & FLAG_REQUIRED) && optentry->strarg)
659
+			    shortopts[sc++] = ':';
660
+		    }
659 661
 		}
660 662
 	    }
661 663
 	}