[PATCH 5/5] reg: Simplify syntax and help logic
Alexandre Julliard
julliard at winehq.org
Tue May 24 08:35:55 CDT 2016
Hugh McMaster <hugh.mcmaster at outlook.com> writes:
> @@ -907,19 +915,16 @@ int wmain(int argc, WCHAR *argvW[])
> return 0;
> }
>
> + option_help = (!lstrcmpW(argvW[2], slashHelpW) || !lstrcmpiW(argvW[2], slashHW));
You should check argc first.
> - if (argc < 3)
> - {
> - output_message(STRING_INVALID_SYNTAX);
> - output_message(STRING_FUNC_HELP, struprW(argvW[1]));
> - return 1;
> - }
> - else if (argc == 3 && (!lstrcmpW(argvW[2], slashHelpW) ||
> - !lstrcmpiW(argvW[2], slashHW)))
> + if (argc < 3 || (argc > 3 && option_help))
> + return invalid_syntax(argvW[1]);
> + else if (option_help)
> {
This doesn't feel like much of an improvement. You could probably come
up with more useful helper functions.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list