It was ignoring the command line parameters

because there was an extraneous argv[1] that was
a repeat of the module name, but in quotation
marks.  The processing in pcmain stops on the first
argument that doesn't start with '-' so my other
arguments got ignored.

 argv[0] 0x00b40800 "C:\test\binary\nethackw.exe"
 argv[1] 0x00b40878 ""C:\test\binary\nethackw.exe""
 argv[2] 0x00b408f0 "-uwizard"
 argv[3] 0x00b40938 "-D"
This commit is contained in:
nethack.allison
2002-01-23 00:00:02 +00:00
parent 1b91f47b4c
commit f48b00f5f5

View File

@@ -75,12 +75,9 @@ int APIENTRY WinMain(HINSTANCE hInstance,
wizard = TRUE;
#endif
/* get command line parameters */
GetModuleFileName(NULL, wbuf, BUFSZ);
argv[0] = _strdup(NH_W2A(wbuf, buf, BUFSZ));
/* get command line parameters */
p = _tcstok(GetCommandLine(), TEXT(" "));
for( argc=1; p && argc<MAX_CMDLINE_PARAM; argc++ ) {
for( argc=0; p && argc<MAX_CMDLINE_PARAM; argc++ ) {
len = _tcslen(p);
if( len>0 ) {
argv[argc] = _strdup( NH_W2A(p, buf, BUFSZ) );
@@ -89,7 +86,9 @@ int APIENTRY WinMain(HINSTANCE hInstance,
}
p = _tcstok(NULL, TEXT(" "));
}
GetModuleFileName(NULL, wbuf, BUFSZ);
argv[0] = _strdup(NH_W2A(wbuf, buf, BUFSZ));
pcmain(argc,argv);
moveloop();