From: nethack.allison Date: Wed, 23 Jan 2002 00:00:02 +0000 (+0000) Subject: It was ignoring the command line parameters X-Git-Tag: MOVE2GIT~3387 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f48b00f5f5f423bbf014837469006462e6d96b98;p=nethack 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" --- diff --git a/win/win32/winhack.c b/win/win32/winhack.c index fa1563fec..655f03c8b 100644 --- a/win/win32/winhack.c +++ b/win/win32/winhack.c @@ -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 && argc0 ) { 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();