Andrey Turkin : extrac32: Enhance command-line parsing.

Alexandre Julliard julliard at winehq.org
Mon Mar 1 09:27:34 CST 2010


Module: wine
Branch: master
Commit: 9939fd6012b0f48c30293f85af47746dc4a81bce
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9939fd6012b0f48c30293f85af47746dc4a81bce

Author: Andrey Turkin <andrey.turkin at gmail.com>
Date:   Sun Feb 28 17:50:16 2010 +0300

extrac32: Enhance command-line parsing.

---

 programs/extrac32/extrac32.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/programs/extrac32/extrac32.c b/programs/extrac32/extrac32.c
index d7f2da4..fc1ae1c 100644
--- a/programs/extrac32/extrac32.c
+++ b/programs/extrac32/extrac32.c
@@ -105,10 +105,14 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho
     for(i = 0; i < argc; i++)
     {
         /* Get cabfile */
-        if ((argv[i][0] != '/') && !cabfile)
+        if (argv[i][0] != '/')
         {
-            cabfile = argv[i];
-            continue;
+            if (!cabfile)
+            {
+                cabfile = argv[i];
+                continue;
+            } else
+                break;
         }
         /* Get parameters for commands */
         check = toupperW( argv[i][1] );
@@ -127,11 +131,7 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho
                 break;
             case 'C':
                 if (cmd) return 0;
-                if ((i + 2) >= argc) return 0;
                 cmd = check;
-                cabfile = argv[++i];
-                if (!GetFullPathNameW(argv[++i], MAX_PATH, path, NULL))
-                    return 0;
                 break;
             case 'E':
             case 'D':
@@ -146,6 +146,13 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho
     if (!cabfile)
         return 0;
 
+    if (cmd == 'C')
+    {
+        if ((i + 1) != argc) return 0;
+        if (!GetFullPathNameW(argv[i], MAX_PATH, path, NULL))
+            return 0;
+    }
+
     if (!path[0])
         GetCurrentDirectoryW(MAX_PATH, path);
 




More information about the wine-cvs mailing list