Diff
Not logged in

Differences From:

File src/main.c part of check-in [797d680ef5] - Add code to understand the "https://" prefix on server URLs. Any attempt to use https gives an error at this point, however. This is a work in progress. by drh on 2009-01-13 18:43:47. [view]

To:

File src/main.c part of check-in [f80303ac73] - fix option/argument parsing for the case where an option is missing a required argument. by bharder on 2009-02-09 18:09:03. [view]

@@ -332,8 +332,9 @@
   const char *zReturn = 0;
   assert( hasArg==0 || hasArg==1 );
   nLong = strlen(zLong);
   for(i=2; i<g.argc; i++){
+    if (i+hasArg >= g.argc) break;
     char *z = g.argv[i];
     if( z[0]!='-' ) continue;
     z++;
     if( z[0]=='-' ){
@@ -370,9 +371,9 @@
 void verify_all_options(void){
   int i;
   for(i=1; i<g.argc; i++){
     if( g.argv[i][0]=='-' ){
-      fossil_fatal("unrecognized command-line option: %s", g.argv[i]);
+      fossil_fatal("unrecognized command-line option, or missing argument: %s", g.argv[i]);
     }
   }
 }