From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wi0-f172.google.com ([209.85.212.172]) by ur; Fri Jul 31 11:30:25 EDT 2015 Received: by wibud3 with SMTP id ud3so36719007wib.0 for <9front@9front.org>; Fri, 31 Jul 2015 08:30:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=bXEGDQMMx7bXaFeI5bPlU5n5vBkwtPi7NgvndAWY4HI=; b=lwXGyVmaxJ+thSrIK02AaZraotsWcjHHwk9syG+E0xxMn1sQWimYCSs9FS0WiNSibz NAtZFSsS4YZP/qVOxJGGoJdOZgRiIyXCCsyqnVojdfDXXF0VXzNCKvWOn68Y9zUGjVO6 AC4qanZ+ktXs/JUNEokxHtJCs8vEzh2w0czOB7nSSt3iE+iQ8bc9n33u31X0rgcTUGa3 kKIwZxdeUrmTcwGnQHRvx/2jHr42yv0Dk1t9hkkxX6GTl3iVQYYb0al3TVjSxtel+y9L 3KmDv/lX+LLdeBpLCjFsqxYbSZvo3ib4TSon1IEcT45hYnYq/mUGfBW7m7b92+afEhR3 +R1w== MIME-Version: 1.0 X-Received: by 10.194.203.138 with SMTP id kq10mr7490427wjc.124.1438356622491; Fri, 31 Jul 2015 08:30:22 -0700 (PDT) Received: by 10.28.62.79 with HTTP; Fri, 31 Jul 2015 08:30:22 -0700 (PDT) In-Reply-To: References: Date: Fri, 31 Jul 2015 18:30:22 +0300 Message-ID: List-ID: <9front.9front.org> X-Glyph: ➈ X-Bullshit: overflow-preventing NoSQL session injection interface Subject: Re: [9front] games/doom: fix config file never being loaded or saved From: qux To: 9front@9front.org Content-Type: text/plain; charset=UTF-8 On 7/30/15, cinap_lenrek@felloff.net wrote: > this can be done better in IdentifyVersion(), where it even used to set > basedefault[]. > > diff -r b357d5b16135 sys/src/games/doom/d_main.c > --- a/sys/src/games/doom/d_main.c Thu Jul 30 20:02:23 2015 +0200 > +++ b/sys/src/games/doom/d_main.c Thu Jul 30 20:28:13 2015 +0200 > @@ -563,7 +563,7 @@ > // > void IdentifyVersion (void) > { > - char *wadfile; > + char *wadfile, *slash; > > if (M_CheckParm ("-shdev")) > { > @@ -615,35 +615,35 @@ > language = french; > printf("French version\n"); > D_AddFile (wadfile); > - return; > } else if ( (wadfile = I_IdentifyWAD("doom2.wad")) ) { > gamemode = commercial; > D_AddFile (wadfile); > - return; > } else if ( (wadfile = I_IdentifyWAD("plutonia.wad")) ) { > gamemode = commercial; > D_AddFile (wadfile); > - return; > } else if ( (wadfile = I_IdentifyWAD("tnt.wad")) ) { > gamemode = commercial; > D_AddFile (wadfile); > - return; > } else if ( (wadfile = I_IdentifyWAD("doomu.wad")) ) { > gamemode = retail; > D_AddFile (wadfile); > - return; > } else if ( (wadfile = I_IdentifyWAD("doom.wad")) ) { > gamemode = registered; > D_AddFile (wadfile); > - return; > } else if ( (wadfile = I_IdentifyWAD("doom1.wad")) ) { > gamemode = shareware; > D_AddFile (wadfile); > - return; > } else { > printf("Game mode indeterminate.\n"); > gamemode = indetermined; > + return; > } > + strncpy(basedefault, wadfile, sizeof(basedefault)-5); > + basedefault[sizeof(basedefault)-5] = '\0'; > + slash = strrchr(basedefault, '/'); > + if (slash++ == 0) > + slash = basedefault; > + strcpy(slash, "cfg"); > } > > // > > -- > cinap > Yeah, it's much better that way. Thank you for your work! qwx