MakeNSIS now returns 0 for various successful information commands (bug #1193)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6939 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2017-10-23 17:55:23 +00:00
parent 02843c142d
commit 6a5876bbc8
2 changed files with 15 additions and 6 deletions

View file

@ -28,6 +28,8 @@ Released on ??? ??rd, 20??
\b Removed unused NSD_LB_Clear macro parameter
\b MakeNSIS now returns 0 for various information commands (\W{http://sf.net/p/nsis/bugs/1193}{bug #1193})
\S2{} Translations
\b Updated Italian (\W{http://sf.net/p/nsis/bugs/1194}{bug #1194})

View file

@ -171,6 +171,7 @@ static void print_usage()
_T(" ") OPT_STR _T("HDRINFO prints information about what options makensis was compiled with\n")
_T(" ") OPT_STR _T("LICENSE prints the makensis software license\n")
_T(" ") OPT_STR _T("VERSION prints the makensis version and exits\n")
//_T(" ") OPT_STR _T("HELP this usage info\n")
#ifdef _WIN32
_T(" ") OPT_STR _T("Px sets the compiler process priority, where x is 5=realtime,4=high,\n")
_T(" ") _T(" 3=above normal,2=normal,1=below normal,0=idle\n")
@ -419,7 +420,7 @@ static inline int makensismain(int argc, TCHAR **argv)
// g_output is now initialized and Print*/_[f]tprintf can be used
if (!stdoutredir) PrintColorFmtMsg_WARN(_T("Error opening output log for writing! Using stdout.\n"));
unsigned int nousage=0;
unsigned int nousage=0, performed=0;
unsigned int files_processed=0;
unsigned int cmds_processed=0;
@ -466,10 +467,15 @@ static inline int makensismain(int argc, TCHAR **argv)
else if (!_tcsicmp(swname,_T("NOCD"))) do_cd=false;
else if (!_tcsicmp(swname,_T("NOCONFIG"))) noconfig=true;
else if (!_tcsicmp(swname,_T("PAUSE"))) g_dopause=true;
else if (!_tcsicmp(swname,_T("HELP")))
{
print_usage();
performed |= ++nousage;
}
else if (!_tcsicmp(swname,_T("LICENSE")))
{
if (build.display_info) print_license();
nousage++;
performed |= ++nousage;
}
else if (!_tcsicmp(swname,_T("CMDHELP")))
{
@ -477,12 +483,12 @@ static inline int makensismain(int argc, TCHAR **argv)
build.print_help(argv[++argpos]);
else
build.print_help(NULL);
nousage++;
performed |= ++nousage;
}
else if (!_tcsicmp(swname,_T("HDRINFO")))
{
print_stub_info(build);
nousage++;
performed |= ++nousage;
}
else if (!_tcsicmp(swname,_T("INPUTCHARSET")) || !_tcsicmp(swname,_T("ICS")))
{
@ -639,13 +645,14 @@ static inline int makensismain(int argc, TCHAR **argv)
argpos++;
}
if (argpos < argc || (!files_processed && !cmds_processed))
bool parsed_all_params = argpos >= argc, processed_any = files_processed || cmds_processed;
if (!parsed_all_params || !processed_any)
{
if (build.display_errors && !nousage)
{
print_usage();
}
return 1;
return performed && parsed_all_params ? 0 : 1;
}
if (build.preprocessonly) return 0;