Fix processing of the command line.

This commit is contained in:
Pavel Roskin 2003-09-25 20:21:32 +00:00 committed by Alexandre Julliard
parent 16cd86197a
commit 1341e9ae2b
1 changed files with 31 additions and 35 deletions

View File

@ -30,43 +30,39 @@ void launch(const char *what)
exit(0); exit(0);
} }
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, CHAR *szParam, INT argc) int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszCmdLine, INT nCmdShow)
{ {
char szParams[255];
lstrcpy(szParams, lpszCmdLine);
CharUpper(szParams);
char szParams[255]; /* no parameters - pop up whole "Control Panel" by default */
lstrcpy(szParams, szParam); if (!*szParams) {
CharUpper(szParams); launch("");
return 0;
}
switch (argc) { /* check for optional parameter */
case 0: /* no parameters - pop up whole "Control Panel" by default */ if (!strcmp(szParams,szP_DESKTOP))
launch(""); launch(szC_DESKTOP);
break; if (!strcmp(szParams,szP_COLOR))
launch(szC_COLOR);
if (!strcmp(szParams,szP_DATETIME))
launch(szC_DATETIME);
if (!strcmp(szParams,szP_DESKTOP))
launch(szC_DESKTOP);
if (!strcmp(szParams,szP_INTERNATIONAL))
launch(szC_INTERNATIONAL);
if (!strcmp(szParams,szP_KEYBOARD))
launch(szC_KEYBOARD);
if (!strcmp(szParams,szP_MOUSE))
launch(szC_MOUSE);
if (!strcmp(szParams,szP_PORTS))
launch(szC_PORTS);
if (!strcmp(szParams,szP_PRINTERS))
launch(szC_PRINTERS);
case 1: /* check for optional parameter */ /* try to launch if a .cpl file is given directly */
if (!strcmp(szParams,szP_DESKTOP)) launch(szParams);
launch(szC_DESKTOP); return 0;
if (!strcmp(szParams,szP_COLOR))
launch(szC_COLOR);
if (!strcmp(szParams,szP_DATETIME))
launch(szC_DATETIME);
if (!strcmp(szParams,szP_DESKTOP))
launch(szC_DESKTOP);
if (!strcmp(szParams,szP_INTERNATIONAL))
launch(szC_INTERNATIONAL);
if (!strcmp(szParams,szP_KEYBOARD))
launch(szC_KEYBOARD);
if (!strcmp(szParams,szP_MOUSE))
launch(szC_MOUSE);
if (!strcmp(szParams,szP_PORTS))
launch(szC_PORTS);
if (!strcmp(szParams,szP_PRINTERS))
launch(szC_PRINTERS);
/* try to launch if a .cpl file is given directly */
launch(szParams);
break;
default: printf("Syntax error.");
}
return 0;
} }