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
+3 -4
View File
@@ -76,11 +76,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,
#endif #endif
/* get command line parameters */ /* get command line parameters */
GetModuleFileName(NULL, wbuf, BUFSZ);
argv[0] = _strdup(NH_W2A(wbuf, buf, BUFSZ));
p = _tcstok(GetCommandLine(), TEXT(" ")); 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); len = _tcslen(p);
if( len>0 ) { if( len>0 ) {
argv[argc] = _strdup( NH_W2A(p, buf, BUFSZ) ); argv[argc] = _strdup( NH_W2A(p, buf, BUFSZ) );
@@ -89,6 +86,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,
} }
p = _tcstok(NULL, TEXT(" ")); p = _tcstok(NULL, TEXT(" "));
} }
GetModuleFileName(NULL, wbuf, BUFSZ);
argv[0] = _strdup(NH_W2A(wbuf, buf, BUFSZ));
pcmain(argc,argv); pcmain(argc,argv);