diff --git a/Source/makenssi.cpp b/Source/makenssi.cpp index 6ea95896..7dc7f40e 100644 --- a/Source/makenssi.cpp +++ b/Source/makenssi.cpp @@ -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], "-")) { - char *p=argv[argpos]+2; - if (p[0]) + if ((argv[argpos][1]=='D' || argv[argpos][1]=='d') && argv[argpos][2]) { + char *p=argv[argpos]+2; char *s=strdup(p),*v; if (build.display_script) { @@ -152,117 +152,113 @@ int main(int argc, char **argv) build.define(s,v?v:""); free(s); } - else + else if ((argv[argpos][1]=='X' || argv[argpos][1]=='x') && argv[argpos][2]) { - 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]) - { - if (build.process_oneline(argv[argpos]+2,"command line",argpos+1) != PS_OK) - { - return 1; - } - cmds_processed++; - } - else if (argv[argpos][0]=='/' && (argv[argpos][1]=='O' || argv[argpos][1]=='o') && argv[argpos][2]) - { - if (!outputtried) - { - g_output=fopen(argv[argpos]+2,"w"); - if (!g_output) + if (build.process_oneline(argv[argpos]+2,"command line",argpos+1) != PS_OK) { - if (build.display_errors) printf("Error opening output log for writing. Using stdout.\n"); - g_output=stdout; + return 1; } - outputtried=1; + cmds_processed++; } - } - else if (!stricmp(argv[argpos],"/NOCD")) do_cd=0; - else if (argv[argpos][0] == '/' && (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'; - build.display_script=v>3; - build.display_info=v>2; - build.display_warnings=v>1; - 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")) - { - if (build.display_info) + else if ((argv[argpos][1]=='O' || argv[argpos][1]=='o') && argv[argpos][2]) { - 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 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" - "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" - " 1. The origin of this software must not be misrepresented; you must not claim\n" - " that you wrote the original software. If you use this software in a\n" - " product, an acknowledgment in the product documentation would be\n" - " appreciated but is not required.\n" - " 2. Altered source versions must be plainly marked as such, and must not be\n" - " misrepresented as being the original software.\n" - " 3. This notice may not be removed or altered from any source distribution.\n\n"); - fflush(g_output); + if (!outputtried) + { + g_output=fopen(argv[argpos]+2,"w"); + if (!g_output) + { + if (build.display_errors) printf("Error opening output log for writing. Using stdout.\n"); + g_output=stdout; + } + outputtried=1; + } } - nousage++; - } - else if (!stricmp(argv[argpos],"/CMDHELP")) - { - if (argpos < argc-1) - build.print_help(argv[++argpos]); - else - build.print_help(NULL); - nousage++; - } - else if (!stricmp(argv[argpos],"/NOTIFYHWND")) - { + 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'; + build.display_script=v>3; + build.display_info=v>2; + build.display_warnings=v>1; + build.display_errors=v>0; + g_display_errors=build.display_errors; + } + 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\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\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" + " 1. The origin of this software must not be misrepresented; you must not claim\n" + " that you wrote the original software. If you use this software in a\n" + " product, an acknowledgment in the product documentation would be\n" + " appreciated but is not required.\n" + " 2. Altered source versions must be plainly marked as such, and must not be\n" + " misrepresented as being the original software.\n" + " 3. This notice may not be removed or altered from any source distribution.\n\n"); + fflush(g_output); + } + nousage++; + } + else if (!stricmp(&argv[argpos][1],"CMDHELP")) + { + if (argpos < argc-1) + build.print_help(argv[++argpos]); + else + build.print_help(NULL); + nousage++; + } + else if (!stricmp(&argv[argpos][1],"NOTIFYHWND")) + { #ifdef _WIN32 - build.notify_hwnd=(HWND)atol(argv[++argpos]); - if (!IsWindow(build.notify_hwnd)) - build.notify_hwnd=0; + build.notify_hwnd=(HWND)atol(argv[++argpos]); + if (!IsWindow(build.notify_hwnd)) + build.notify_hwnd=0; #else - argpos++; - build.warning("/NOTIFYHWND is disabled for non Win32 platforms."); + argpos++; + build.warning(OPT_STR "NOTIFYHWND is disabled for non Win32 platforms."); #endif - } - else if (!stricmp(argv[argpos],"/HDRINFO")) - { - if (build.display_info) - { - fprintf(g_output,"Size of zlib EXE header is %d bytes.\n",zlib_exehead_size); - fprintf(g_output,"Size of bzip2 EXE header is %d bytes.\n",bzip2_exehead_size); - fprintf(g_output,"Size of lzma EXE header is %d bytes.\n",lzma_exehead_size); - fprintf(g_output,"Size of first header is %d bytes.\n",sizeof(firstheader)); - fprintf(g_output,"Size of main header is %d bytes.\n",sizeof(header)); - fprintf(g_output,"Size of each section is %d bytes.\n",sizeof(section)); - fprintf(g_output,"Size of each page is %d bytes.\n",sizeof(page)); - fprintf(g_output,"Size of each instruction is %d bytes.\n",sizeof(entry)); - int x=build.definedlist.getnum(); - fprintf(g_output,"\nDefined symbols: "); - for (int i=0; i\\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 " 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); }