]> granicus.if.org Git - nethack/commitdiff
It was ignoring the command line parameters
authornethack.allison <nethack.allison>
Wed, 23 Jan 2002 00:00:02 +0000 (00:00 +0000)
committernethack.allison <nethack.allison>
Wed, 23 Jan 2002 00:00:02 +0000 (00:00 +0000)
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"

win/win32/winhack.c

index fa1563feccbe1e18fcd69d8dc0e05c27ab63579b..655f03c8bd9fb36d0a2c8c5c3fb990453eed1dc3 100644 (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();