regsvr32: Convert if-else block to switch statement.

This commit is contained in:
Hugh McMaster 2015-06-15 22:12:45 +10:00 committed by Alexandre Julliard
parent 00c13a20a6
commit dc1b177a1a
1 changed files with 26 additions and 18 deletions

View File

@ -52,6 +52,7 @@
#include "wine/port.h" #include "wine/port.h"
#include <string.h> #include <string.h>
#include <ctype.h>
#include <windows.h> #include <windows.h>
#include <ole2.h> #include <ole2.h>
#include "regsvr32.h" #include "regsvr32.h"
@ -252,27 +253,34 @@ int main(int argc, char* argv[])
*/ */
for(i = 1; i < argc; i++) for(i = 1; i < argc; i++)
{ {
if ((!strcasecmp(argv[i], "/u")) ||(!strcasecmp(argv[i], "-u"))) if ((argv[i][0] == '/' || argv[i][0] == '-') && (!argv[i][2] || argv[i][2] == ':'))
Unregister = TRUE;
else if ((!strcasecmp(argv[i], "/s"))||(!strcasecmp(argv[i], "-s")))
Silent = TRUE;
else if ((!strncasecmp(argv[i], "/i", strlen("/i")))||(!strncasecmp(argv[i], "-i", strlen("-i"))))
{ {
switch (tolower(argv[i][1]))
{
case 'u':
Unregister = TRUE;
break;
case 's':
Silent = TRUE;
break;
case 'i':
CallInstall = TRUE; CallInstall = TRUE;
wsCommandLine = parse_command_line(argv[i] + strlen("/i")); wsCommandLine = parse_command_line(argv[i] + strlen("/i"));
if (!wsCommandLine) if (!wsCommandLine)
wsCommandLine = EmptyLine; wsCommandLine = EmptyLine;
} break;
else if((!strcasecmp(argv[i], "/n"))||(!strcasecmp(argv[i], "-n"))) case 'n':
CallRegister = FALSE; CallRegister = FALSE;
else if((!strcasecmp(argv[i], "/c"))||(!strcasecmp(argv[i], "-c"))) break;
case 'c':
/* console output */; /* console output */;
else if (argv[i][0] == '/' && (!argv[i][2] || argv[i][2] == ':')) break;
{ default:
output_write(STRING_UNRECOGNIZED_SWITCH, argv[i]); output_write(STRING_UNRECOGNIZED_SWITCH, argv[i]);
output_write(STRING_USAGE); output_write(STRING_USAGE);
return 1; return 1;
} }
}
else else
{ {
char *DllName = argv[i]; char *DllName = argv[i];