]> granicus.if.org Git - nethack/commitdiff
from <Someone>
authornethack.allison <nethack.allison>
Tue, 12 Feb 2002 23:00:27 +0000 (23:00 +0000)
committernethack.allison <nethack.allison>
Tue, 12 Feb 2002 23:00:27 +0000 (23:00 +0000)
Combine the 32x32 icon and the 16x16 icon into a single file.
Clean up the command line argument processing a little.

sys/winnt/nhico.uu
win/win32/winhack.c

index ae06fb468f00d02740141e431df6f71df112ba6a..b420c3c1ea461436a3b618f64d2e63367907fb70 100644 (file)
@@ -1,70 +1,27 @@
 begin 600 nethack.ico
-M```!``$`*"@```$`"`"H"P``%@```"@````H````4`````$`"```````````
-M````````````````````````````P````/_`_P#`P/\`W-S<`/_`P`"`@```
-MH*"@`(````!86%@`@`"``/___P#`__\`P,```/__P`#`_\``P\/#`*C<_P#_
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````"PL+$0\`````
-M````````````````````#Q$0$0\`````````````"PL+"Q`1````````````
-M````````````$!$0#Q`1$```````````"PL+`@L$$!$`````````````````
-M``````\$!!`$`P\```````````L+!P<-"00/$```````"PL0#P```````!`1
-M"0D'``8#$``````````+"PT`!PD)$1``````"PL+$1`1```````1!`8)#0<)
-M#Q$`````````"PL`!PT*!@01````"PL+"P0#$`\`````$1`)``<&"000````
-M```````+"PL'#0<+"P``"PL`!PT)!@<$$`````\0!PT)$1`1````````````
-M``L+"P<`"PL`"PL`$@<)!PD&"00/```0$0`'$!`/````````````````"PL+
-M"P8)"P0'!P8'#0D&!PD)$!$````1$`\1```````````````````+"PL'#@L'
-M#0<'!PD%"`D&``D$#P``#Q$0``````````````````````L+``L+$@<'`0<-
-M"08%"0D&"001`!$0``````````````````````````L+#0<-!P<-"@<&"08`
-M"0D&!!$````````````````````````````+`@<'!P<!!P<&"0<)"08)"1$$
-M```````````````````````````+"PT'$A``#0<)!P8`!@D`!@D&$1``````
-M````````````````````"PL'!P<-!PH-!PD&!PD&"0D`"001````````````
-M````````````"PL'$@<-!P<-!P$'!@D)``8)!@D&$0\`````````````````
-M``````L"#0<'!Q('!@<'!@D'!@D)!@`)"000```````````````````````+
-M"P<'#0<-!P<2``<&"0`&``D)!@D/$0``````````````````````"P(-!Q('
-M``<&!P<&"0<&"0D)!@`)$1````````````````````````L+!P`%!@42!P<&
-M!PD&"0`&"0D)!A$/```````````````````````+`@T'#0<'!PD-!PD&!PD&
-M``D&``D0$0``````````````````````"PL'!P<2!PT'!P$'!@`)"0D&"0D&
-M#!`````````````````+"PD&"0L+!Q('#0<'`0<'!@D'"08)``8`"1`1````
-M$!$`````````"PL+"PD+"P`-!P<-!P<-"0<&"08`"08)!@D/$``$$1`/````
-M``````L+"PL)"PL'!P<2!P<!!P<&"0<)!@D)``D)$1``$0\$$0`````````-
-M!P8)!@L+#0<-!PT'``T)!P8)!@`)!@D&``\1````"08```````````<)"0D+
-M"P`'``<`!P8'``D&!PD)!@D)"0D0$`````D)``````````L+"PL`"PL+"PL+
-M"PL+"Q$+$1`0$1$/$1`1#Q$`$!`1#P`````````+"PL+``L+"PL+"PL+$`L+
-M$!`+$0\0$1`/$!$0`!$/$1``````````"PL````+"PL+"PL+"PL+$0L1$`\1
-M$`\1$0\1$````!`1````````````````"PL+``L+"PL0"PL/$`L1$!$0$``0
-M$!$```````````````````````L+````"PL+"PL0"Q$/$!$/$0```!$/````
-M```````````````````+````````"Q`+"Q$0"Q$0````````$```````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-D````````````````````````````````````````````````
+M```!``(`("`0``````#H`@``)@```!`0$```````*`$```X#```H````(```
+M`$`````!``0``````(`"````````````````````````````````@```@```
+M`("``(````"``(``@(```,#`P`"`@(````#_``#_````__\`_P```/\`_P#_
+M_P``____````````````````````````__=P```````````'=W<`#___=P``
+M````````?_?W<`]W:/=P``#_<```!WB'!G`/8'B'<``/_W<```?VAGAP#P=E
+M;W``__]W<``'>`=H\`__=G_P#_!V9_<`!W=H=W``__</\/\,>(:/<`=P=W<`
+M``__\`_W=G9GB'<`!W=P````__#_=G=X2&"/<`=W``````_P_\=T=F>(:/<'
+M<```````#_9V=V5H8(AO<`````````_W=W1WAXAHA_````````#_9\<&>&!H
+M!H9W````````_W=V=6=GAH@(]P``````#_?'9W9T:(!H:&=P``````_V=WQV
+M=X=HA@B/<``````/]GQP=G>':(A@AW``````#_<'9\=VAH!HB&=P``````_V
+M=G=X9V>&"&"'<``````/]W?'9W1@B(:(9W````^&C_?'9W1WAX:`8(=P`'`/
+M_X_P9W9W:&A@AH:'</=P#_^/]W?'='>'AH@(AW!W\`=H;_9V=G!H:&"&A@=P
+M`(`'B(_P<'!V<&>(:(B'<`"`#_\/______=W=W=W=W!W<`__#_____?_?W=W
+M=W=P=W`/``__#___]W=W=W!W<`!P```/\`#_]_]_=W<`!W``````#P```/_W
+M=W<```!P````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M```````````````````````H````$````"`````!``0``````,``````````
+M````````````````````````@```@````("``(````"``(``@(```,#`P`"`
+M@(````#_``#_````__\`_P```/\`_P#__P``____`````````````/<`````
+M=P`/_W`/<`=W<`#_\/8'!W<```\/9F!P<````/9F!@<`````]F9@9P````]F
+M9@8&<```#V9F8&!P```/9F8&!G````]F9F!@<``/?V9F!@9P<`]_9F9@8'!P
+M#P___W=W<'``#P__=W!P````````````````````````````````````````
+K````````````````````````````````````````````````````````````
 `
 end
index 20b7f372954374b928c678c158b58e015855bd24..535e448de6c06289c3a391ead417fc3d7c5ae204 100644 (file)
@@ -17,6 +17,7 @@
 #endif
 
 extern void FDECL(nethack_exit,(int));
+static TCHAR* _get_cmd_arg(TCHAR* pCmdLine);
 
 // Global Variables:
 NHWinApp _nethack_app;
@@ -43,7 +44,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
        int argc;
        char* argv[MAX_CMDLINE_PARAM];
        size_t len;
-       TCHAR *p, *p2;
+       TCHAR *p;
        TCHAR wbuf[BUFSZ];
        char buf[BUFSZ];
 
@@ -78,22 +79,16 @@ int APIENTRY WinMain(HINSTANCE hInstance,
        }
 
        /* get command line parameters */       
-       argc = 0;
-       p = GetCommandLine();
-       if (p && *p == _T('"')) {
-               p2 = _tcschr(p + 1, _T('"'));
-               p = p2 + 2;
-               argc = 1;
-       }
-       p = _tcstok(p, TEXT(" "));
-       for( ; p && argc<MAX_CMDLINE_PARAM; argc++ ) {
+       p = _get_cmd_arg(GetCommandLine());
+       p = _get_cmd_arg(NULL); /* skip first paramter - command name */
+       for( argc = 1; p && argc<MAX_CMDLINE_PARAM; argc++ ) {
                len = _tcslen(p);
                if( len>0 ) {
                        argv[argc] = _strdup( NH_W2A(p, buf, BUFSZ) );
                } else {
                        argv[argc] = "";
                }
-               p = _tcstok(NULL, TEXT(" "));
+               p = _get_cmd_arg(NULL);
        }
        GetModuleFileName(NULL, wbuf, BUFSZ);
        argv[0] = _strdup(NH_W2A(wbuf, buf, BUFSZ));
@@ -139,3 +134,41 @@ PNHWinApp GetNHApp()
        return &_nethack_app;
 }
 
+TCHAR* _get_cmd_arg(TCHAR* pCmdLine)
+{
+        static TCHAR* pArgs = NULL;
+        TCHAR  *pRetArg;
+        BOOL   bQuoted;
+
+        if( !pCmdLine && !pArgs ) return NULL;
+        if( !pArgs ) pArgs = pCmdLine;
+
+        /* skip whitespace */
+        for(pRetArg = pArgs; *pRetArg && _istspace(*pRetArg); pRetArg = CharNext(pRetArg));
+               if( !*pRetArg ) {
+                       pArgs = NULL;
+                       return NULL;
+               }
+
+        /* check for quote */
+        if( *pRetArg==TEXT('"') ) {
+                bQuoted = TRUE;
+                pRetArg = CharNext(pRetArg);
+                               pArgs = _tcschr(pRetArg, TEXT('"'));
+           } else {
+                       /* skip to whitespace */
+                       for(pArgs = pRetArg; *pArgs && !_istspace(*pArgs); pArgs = CharNext(pArgs));
+               }
+               
+               if( pArgs && *pArgs ) {
+                       TCHAR* p;
+                       p = pArgs;
+                       pArgs = CharNext(pArgs);
+                       *p = (TCHAR)0;
+               } else {
+                       pArgs = NULL;
+               }
+
+               return pRetArg;
+}
+