fixed bug #1661503: inconsistency between Win32/Linux makensis command line options

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4961 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
pabs3 2007-03-02 04:35:35 +00:00
parent 9cbba1c7ba
commit 3d7194ee59
3 changed files with 12 additions and 20 deletions

View file

@ -280,7 +280,7 @@ void CompileNSISScript() {
}
s = (char *)GlobalAlloc(GPTR, lstrlen(g_sdata.script)+lstrlen(symbols)+lstrlen(compressor)+sizeof(EXENAME)+sizeof(" /NOTIFYHWND ")+20);
wsprintf(s,"%s %s%s /NOTIFYHWND %d %s",EXENAME,compressor,symbols,g_sdata.hwnd,g_sdata.script);
wsprintf(s,"%s %s%s /NOTIFYHWND %d -- %s",EXENAME,compressor,symbols,g_sdata.hwnd,g_sdata.script);
GlobalFree(symbols);
if (g_sdata.script_alloced) GlobalFree(g_sdata.script);
g_sdata.script_alloced = true;

View file

@ -116,11 +116,13 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
# define PLATFORM_PATH_SEPARATOR_C '\\'
# define OPT_STR "/"
# define OPT_C '/'
# define IS_OPT(a) (a[0]==OPT_C||a[0]=='-')
#else
# define PLATFORM_PATH_SEPARATOR_STR "/"
# define PLATFORM_PATH_SEPARATOR_C '/'
# define OPT_STR "-"
# define OPT_C '-'
# define IS_OPT(a) (a[0]==OPT_C)
#endif
// attributes

View file

@ -140,7 +140,11 @@ static void print_usage()
" " 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"
" parameters are processed by order (" OPT_STR "Ddef ins.nsi != ins.nsi " OPT_STR "Ddef)\n"
" for script file name, you can use - to read from the standard input\n");
" for script file name, you can use - to read from the standard input\n"
#ifdef _WIN32
" you can also use - as an option character: -PAUSE as well as /PAUSE\n"
#endif
" you can use a double-dash to end options processing: makensis -- -ins.nsi\n");
fflush(g_output);
}
@ -251,9 +255,7 @@ int main(int argc, char **argv)
FILE *fp;
int tmpargpos=1;
int no_logo=0;
#ifndef _WIN32
int in_files=0;
#endif
try
{
@ -266,13 +268,13 @@ int main(int argc, char **argv)
return 1;
}
if (argc > 1 && !stricmp(argv[1], OPT_STR "VERSION"))
if (argc > 1 && IS_OPT(argv[1]) && !stricmp(&argv[1][1],"VERSION"))
{
fprintf(g_output,NSIS_VERSION);
fflush(g_output);
return 0;
}
if (argc > 1 && argv[1][0]==OPT_C && (argv[1][1]=='v' || argv[1][1]=='V'))
if (argc > 1 && IS_OPT(argv[1]) && (argv[1][1]=='v' || argv[1][1]=='V'))
{
tmpargpos++;
if (argv[1][2] <= '2' && argv[1][2] >= '0')
@ -283,7 +285,7 @@ int main(int argc, char **argv)
if (!no_logo)
{
if (argc > tmpargpos && argv[tmpargpos][0]==OPT_C && (argv[tmpargpos][1]=='o' || argv[tmpargpos][1]=='O') && argv[tmpargpos][2])
if (argc > tmpargpos && IS_OPT(argv[tmpargpos]) && (argv[tmpargpos][1]=='o' || argv[tmpargpos][1]=='O') && argv[tmpargpos][2])
{
g_output=fopen(argv[tmpargpos]+2,"w");
if (!g_output)
@ -301,13 +303,9 @@ int main(int argc, char **argv)
if (!g_output) g_output=stdout;
while (argpos < argc)
{
#ifndef _WIN32
if (!strcmp(argv[argpos], "--"))
in_files=1;
else if (argv[argpos][0] == OPT_C && strcmp(argv[argpos], "-") && !in_files)
#else
if (argv[argpos][0] == OPT_C && strcmp(argv[argpos], "-"))
#endif
else if (IS_OPT(argv[argpos]) && strcmp(argv[argpos], "-") && !in_files)
{
if ((argv[argpos][1]=='D' || argv[argpos][1]=='d') && argv[argpos][2])
{
@ -427,11 +425,7 @@ int main(int argc, char **argv)
else
{
files_processed++;
#ifndef _WIN32
if (!strcmp(argv[argpos],"-") && !in_files)
#else
if (!strcmp(argv[argpos],"-"))
#endif
g_dopause=0;
if (!g_noconfig)
{
@ -466,11 +460,7 @@ int main(int argc, char **argv)
{
char sfile[1024];
#ifndef _WIN32
if (!strcmp(argv[argpos],"-") && !in_files)
#else
if (!strcmp(argv[argpos],"-"))
#endif
{
fp=stdin;
strcpy(sfile,"stdin");