[wineconsole] Better option handling (4/4)

Peter Berg Larsen pebl at math.ku.dk
Sat Nov 29 00:59:35 CST 2003


Once too many did I write "... --backend=users /path/progname" that failed
with "... (s /path/progname), invalid/missing command line arguments" and
started looking for a wrong path without noticing the 's '. (The option
value is user not users)

Changelog:
- Require space after --backend= option and output a more detailed cause
  of failure.
-------------- next part --------------
--- wine-20031118/programs/wineconsole/wineconsole.c	2003-11-29 07:04:18.000000000 +0100
+++ wine-my/programs/wineconsole/wineconsole.c	2003-11-29 07:05:53.000000000 +0100
@@ -706,27 +706,38 @@
         {
             char*           end;
             wci->event = (HANDLE)strtol(wci->ptr + 12, &end, 10);
-            if (end == wci->ptr + 12) return FALSE;
+            if (end == wci->ptr + 12) 
+	    {
+                WINE_ERR("The --use-event option must be set to an integer value.\n");
+		return FALSE;
+	    }
             wci->mode = from_event;
             wci->ptr = end;
             wci->backend = WCUSER_InitBackend;
         }
         else if (strncmp(wci->ptr, "--backend=", 10) == 0)
         {
-            if (strncmp(wci->ptr + 10, "user", 4) == 0)
+            if (strncmp(wci->ptr + 10, "user ", 5) == 0)
             {
                 wci->backend = WCUSER_InitBackend;
                 wci->ptr += 14;
             }
-            else if (strncmp(wci->ptr + 10, "curses", 6) == 0)
+            else if (strncmp(wci->ptr + 10, "curses ", 7) == 0)
             {
+                wci->backend = WCCURSES_InitBackend;
                 wci->ptr += 16;
             }
             else
+	    {
+                WINE_ERR("The --backend option can only be set to: 'curses' or 'user'.\n");
                 return FALSE;
+	    }
         }
         else
+	{     
+	    WINE_ERR("Found an options (-foobar) that was neither '--backend=' nor '--use-event='.\n");
             return FALSE;
+	}
     }
 
     return TRUE;


More information about the wine-patches mailing list