Fixed bug #1203, -CMDHELP should be printed to stdout
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6982 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
696a317eca
commit
8f9cc7ff35
4 changed files with 15 additions and 7 deletions
|
@ -8,6 +8,8 @@ Released on ??? ??th, 20??
|
|||
|
||||
\S2{} Minor Changes
|
||||
|
||||
\b MakeNSIS prints -CMDHELP to stdout (\W{http://sf.net/p/nsis/bugs/1203}{bug #1203})
|
||||
|
||||
\H{v3.03} 3.03
|
||||
|
||||
Released on January 29th, 2018
|
||||
|
|
|
@ -254,6 +254,7 @@ class CEXEBuild {
|
|||
int write_output(void);
|
||||
|
||||
void print_help(const TCHAR *commandname=NULL);
|
||||
bool print_cmdhelp(const TCHAR *commandname, bool cmdhelp=false);
|
||||
|
||||
DefineList definedlist; // List of identifiers marked as "defined" like
|
||||
// C++ macro definitions such as _UNICODE.
|
||||
|
|
|
@ -479,11 +479,8 @@ static inline int makensismain(int argc, TCHAR **argv)
|
|||
}
|
||||
else if (!_tcsicmp(swname,_T("CMDHELP")))
|
||||
{
|
||||
if (argpos < argc-1)
|
||||
build.print_help(argv[++argpos]);
|
||||
else
|
||||
build.print_help(NULL);
|
||||
performed |= ++nousage;
|
||||
if (build.print_cmdhelp(argpos < argc-1 ? argv[++argpos] : NULL, true))
|
||||
performed |= ++nousage;
|
||||
}
|
||||
else if (!_tcsicmp(swname,_T("HDRINFO")))
|
||||
{
|
||||
|
|
|
@ -325,22 +325,30 @@ const TCHAR* CEXEBuild::get_commandtoken_name(int tok)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void CEXEBuild::print_help(const TCHAR *commandname)
|
||||
bool CEXEBuild::print_cmdhelp(const TCHAR *commandname, bool cmdhelp)
|
||||
{
|
||||
// Print function chosen at run time because of bug #1203, -CMDHELP to stdout.
|
||||
void (CEXEBuild::*printer)(const TCHAR *s, ...) const = cmdhelp ? &CEXEBuild::INFO_MSG : &CEXEBuild::ERROR_MSG;
|
||||
UINT x;
|
||||
for (x = 0; x < TOK__LAST; ++x)
|
||||
{
|
||||
if (!commandname || !_tcsicmp(tokenlist[x].name,commandname))
|
||||
{
|
||||
ERROR_MSG(_T("%") NPRIs _T("%") NPRIs _T(" %") NPRIs _T("\n"),commandname?_T("Usage: "):_T(""),tokenlist[x].name,tokenlist[x].usage_str);
|
||||
(this->*printer)(_T("%") NPRIs _T("%") NPRIs _T(" %") NPRIs _T("\n"),commandname?_T("Usage: "):_T(""),tokenlist[x].name,tokenlist[x].usage_str);
|
||||
if (commandname) break;
|
||||
}
|
||||
}
|
||||
if (x == TOK__LAST && commandname)
|
||||
{
|
||||
ERROR_MSG(_T("Invalid command \"%") NPRIs _T("\"\n"),commandname);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEXEBuild::print_help(const TCHAR *commandname)
|
||||
{
|
||||
print_cmdhelp(commandname);
|
||||
}
|
||||
|
||||
bool CEXEBuild::is_ppbranch_token(const TCHAR *s)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue