* applied patch #1055553 (with some changes) - Absolute path of *.nsi not accepted on posix

* updated license line breaking to fit better
* added /VERSION to the usage information text


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3764 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-11-12 13:58:11 +00:00
parent 2b0c2f2787
commit 0657260dbe

View file

@ -93,13 +93,13 @@ int main(int argc, char **argv)
build.setdirs(argv[0]);
if (argc > 1 && !stricmp(argv[1], "/VERSION"))
if (argc > 1 && !stricmp(argv[1], OPT_STR "VERSION"))
{
fprintf(g_output,NSIS_VERSION);
fflush(g_output);
return 0;
}
if (argc > 1 && argv[1][0]=='/' && (argv[1][1]=='v' || argv[1][1]=='V'))
if (argc > 1 && argv[1][0]==OPT_C && (argv[1][1]=='v' || argv[1][1]=='V'))
{
tmpargpos++;
if (argv[1][2] <= '2' && argv[1][2] >= '0')
@ -110,7 +110,7 @@ int main(int argc, char **argv)
if (!no_logo)
{
if (argc > tmpargpos && argv[tmpargpos][0]=='/' && (argv[tmpargpos][1]=='o' || argv[tmpargpos][1]=='O') && argv[tmpargpos][2])
if (argc > tmpargpos && argv[tmpargpos][0]==OPT_C && (argv[tmpargpos][1]=='o' || argv[tmpargpos][1]=='O') && argv[tmpargpos][2])
{
g_output=fopen(argv[tmpargpos]+2,"w");
if (!g_output)
@ -136,11 +136,11 @@ int main(int argc, char **argv)
if (!g_output) g_output=stdout;
while (argpos < argc)
{
if (argv[argpos][0]=='/' && (argv[argpos][1]=='D' || argv[argpos][1]=='d') && argv[argpos][2])
if (argv[argpos][0] == OPT_C && strcmp(argv[argpos], "-"))
{
if ((argv[argpos][1]=='D' || argv[argpos][1]=='d') && argv[argpos][2])
{
char *p=argv[argpos]+2;
if (p[0])
{
char *s=strdup(p),*v;
if (build.display_script)
{
@ -152,12 +152,7 @@ int main(int argc, char **argv)
build.define(s,v?v:"");
free(s);
}
else
{
build.warning("command line /D requires argument (i.e. \"/Ddefine\"). ignored.");
}
}
else if (argv[argpos][0]=='/' && (argv[argpos][1]=='X' || argv[argpos][1]=='x') && argv[argpos][2])
else if ((argv[argpos][1]=='X' || argv[argpos][1]=='x') && argv[argpos][2])
{
if (build.process_oneline(argv[argpos]+2,"command line",argpos+1) != PS_OK)
{
@ -165,7 +160,7 @@ int main(int argc, char **argv)
}
cmds_processed++;
}
else if (argv[argpos][0]=='/' && (argv[argpos][1]=='O' || argv[argpos][1]=='o') && argv[argpos][2])
else if ((argv[argpos][1]=='O' || argv[argpos][1]=='o') && argv[argpos][2])
{
if (!outputtried)
{
@ -178,8 +173,8 @@ int main(int argc, char **argv)
outputtried=1;
}
}
else if (!stricmp(argv[argpos],"/NOCD")) do_cd=0;
else if (argv[argpos][0] == '/' && (argv[argpos][1] == 'V' || argv[argpos][1] == 'v') &&
else if (!stricmp(&argv[argpos][1],"NOCD")) do_cd=0;
else if ((argv[argpos][1] == 'V' || argv[argpos][1] == 'v') &&
argv[argpos][2] >= '0' && argv[argpos][2] <= '4' && !argv[argpos][3])
{
int v=argv[argpos][2]-'0';
@ -189,17 +184,17 @@ int main(int argc, char **argv)
build.display_errors=v>0;
g_display_errors=build.display_errors;
}
else if (!stricmp(argv[argpos],"/NOCONFIG")) g_noconfig=1;
else if (!stricmp(argv[argpos],"/PAUSE")) g_dopause=1;
else if (!stricmp(argv[argpos],"/LICENSE"))
else if (!stricmp(&argv[argpos][1],"NOCONFIG")) g_noconfig=1;
else if (!stricmp(&argv[argpos][1],"PAUSE")) g_dopause=1;
else if (!stricmp(&argv[argpos][1],"LICENSE"))
{
if (build.display_info)
{
fprintf(g_output,"Copyright (C) 1999-2004 Nullsoft, Inc.\n\n"
"This license applies to everything in the NSIS package, except where otherwise noted.\n\n"
"This license applies to everything in the NSIS package, except where otherwise\nnoted.\n\n"
"This software is provided 'as-is', without any express or implied warranty.\n"
"In no event will the authors be held liable for any damages arising from the use\n"
"of this software.\n\n"
"In no event will the authors be held liable for any damages arising from the\n"
"use of this software.\n\n"
"Permission is granted to anyone to use this software for any purpose, including\n"
"commercial applications, and to alter it and redistribute it freely, subject to\n"
"the following restrictions:\n"
@ -214,7 +209,7 @@ int main(int argc, char **argv)
}
nousage++;
}
else if (!stricmp(argv[argpos],"/CMDHELP"))
else if (!stricmp(&argv[argpos][1],"CMDHELP"))
{
if (argpos < argc-1)
build.print_help(argv[++argpos]);
@ -222,7 +217,7 @@ int main(int argc, char **argv)
build.print_help(NULL);
nousage++;
}
else if (!stricmp(argv[argpos],"/NOTIFYHWND"))
else if (!stricmp(&argv[argpos][1],"NOTIFYHWND"))
{
#ifdef _WIN32
build.notify_hwnd=(HWND)atol(argv[++argpos]);
@ -230,10 +225,10 @@ int main(int argc, char **argv)
build.notify_hwnd=0;
#else
argpos++;
build.warning("/NOTIFYHWND is disabled for non Win32 platforms.");
build.warning(OPT_STR "NOTIFYHWND is disabled for non Win32 platforms.");
#endif
}
else if (!stricmp(argv[argpos],"/HDRINFO"))
else if (!stricmp(&argv[argpos][1],"HDRINFO"))
{
if (build.display_info)
{
@ -260,9 +255,10 @@ int main(int argc, char **argv)
}
nousage++;
}
else break;
}
else
{
if (argv[argpos][0]=='/') break;
files_processed++;
if (!strcmp(argv[argpos],"-")) g_dopause=0;
if (!g_noconfig)
@ -387,17 +383,17 @@ int main(int argc, char **argv)
fprintf(g_output,"Usage:\n"
" makensis [options] [script.nsi | - [...]]\n"
" options are:\n"
" /CMDHELP item prints out help for 'item', or lists all commands\n"
" /HDRINFO prints information about what options makensis was compiled with\n"
" /LICENSE prints the makensis software license\n");
fprintf(g_output,
" /Vx verbosity where x is 4=all,3=no script,2=no info,1=no warnings,0=none\n"
" /Ofile specifies a text file to log compiler output (default is stdout)\n"
" /PAUSE pauses after execution\n"
" /NOCONFIG disables inclusion of <path to makensis.exe>\\nsisconf.nsh\n"
" /NOCD disabled the current directory change to that of the .nsi file\n"
" /Ddefine[=value] defines the symbol \"define\" for the script [to value]\n"
" /Xscriptcmd executes scriptcmd in script (i.e. \"/XOutFile poop.exe\")\n"
" " OPT_STR "CMDHELP item prints out help for 'item', or lists all commands\n"
" " OPT_STR "HDRINFO prints information about what options makensis was compiled with\n"
" " OPT_STR "LICENSE prints the makensis software license\n"
" " OPT_STR "VERSION prints the makensis version and exits\n"
" " OPT_STR "Vx verbosity where x is 4=all,3=no script,2=no info,1=no warnings,0=none\n"
" " OPT_STR "Ofile specifies a text file to log compiler output (default is stdout)\n"
" " OPT_STR "PAUSE pauses after execution\n"
" " OPT_STR "NOCONFIG disables inclusion of <path to makensis.exe>" PLATFORM_PATH_SEPARATOR_STR "nsisconf.nsh\n"
" " OPT_STR "NOCD disabled the current directory change to that of the .nsi file\n"
" " OPT_STR "Ddefine[=value] defines the symbol \"define\" for the script [to value]\n"
" " OPT_STR "Xscriptcmd executes scriptcmd in script (i.e. \"" OPT_STR "XOutFile poop.exe\")\n"
" for script file name, you can use - to read from the standard input\n");
fflush(g_output);
}