Hugh McMaster hugh.mcmaster@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.