handle quoting on the command line in uninstaller (take 2)
Mike McCormack
mike at codeweavers.com
Fri Oct 10 13:55:37 CDT 2003
Converted uninstaller to a cui app on Alexandre's suggestion.
Mike
ChangeLog:
* handle quoting on the command line in uninstaller
-------------- next part --------------
Index: programs/uninstaller/Makefile.in
===================================================================
RCS file: /home/wine/wine/programs/uninstaller/Makefile.in,v
retrieving revision 1.12
diff -u -r1.12 Makefile.in
--- programs/uninstaller/Makefile.in 4 Oct 2003 03:10:59 -0000 1.12
+++ programs/uninstaller/Makefile.in 9 Oct 2003 05:26:44 -0000
@@ -3,7 +3,7 @@
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = uninstaller.exe
-APPMODE = gui
+APPMODE = cui
IMPORTS = user32 gdi32 advapi32 kernel32
C_SRCS = \
Index: programs/uninstaller/main.c
===================================================================
RCS file: /home/wine/wine/programs/uninstaller/main.c,v
retrieving revision 1.12
diff -u -r1.12 main.c
--- programs/uninstaller/main.c 25 Sep 2003 20:21:47 -0000 1.12
+++ programs/uninstaller/main.c 9 Oct 2003 05:26:44 -0000
@@ -121,33 +121,43 @@
}
}
-
-int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmdshow )
+int main( int argc, char *argv[])
{
MSG msg;
WNDCLASS wc;
HWND hWnd;
+ LPSTR token = NULL;
+ int i = 1;
+ HINSTANCE hInst = NULL;
- /*------------------------------------------------------------------------
- ** Handle requests just to list the programs
- **----------------------------------------------------------------------*/
- if (cmdline && strlen(cmdline) >= 6 && memcmp(cmdline, "--list", 6) == 0)
+ while( i<argc )
{
- ListUninstallPrograms();
- return(0);
- }
+ token = argv[i++];
- /*------------------------------------------------------------------------
- ** Handle requests to remove one program
- **----------------------------------------------------------------------*/
- if (cmdline && strlen(cmdline) > 9 && memcmp(cmdline, "--remove ", 9) == 0)
- {
- RemoveSpecificProgram(cmdline + 9);
- return(0);
+ /* Handle requests just to list the programs */
+ if( !lstrcmpA( token, "--list" ) )
+ {
+ ListUninstallPrograms();
+ return 0;
+ }
+ else if( !lstrcmpA( token, "--remove" ) )
+ {
+ if( i >= argc )
+ {
+ WINE_ERR( "The remove option requires a parameter.\n");
+ return 1;
+ }
+
+ RemoveSpecificProgram( argv[i++] );
+ return 0;
+ }
+ else
+ {
+ WINE_ERR( "unknown option %s\n",token);
+ return 1;
+ }
}
-
-
LoadString( hInst, IDS_APPNAME, appname, sizeof(appname));
wc.style = 0;
@@ -169,7 +179,7 @@
if (!hWnd) exit(1);
- ShowWindow( hWnd, cmdshow );
+ ShowWindow( hWnd, SW_SHOW );
UpdateWindow( hWnd );
while( GetMessage(&msg, NULL_HANDLE, 0, 0) ) {
More information about the wine-patches
mailing list