From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14270 invoked from network); 24 Jan 2021 10:42:10 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 24 Jan 2021 10:42:10 -0000 Received: from orthanc.ca ([208.79.93.154]) by 1ess; Sun Jan 24 05:28:49 -0500 2021 Received: from orthanc.ca (localhost [127.0.0.1]) by orthanc.ca (OpenSMTPD) with ESMTP id 956598e8 for <9front@9front.org>; Sun, 24 Jan 2021 02:28:48 -0800 (PST) From: Lyndon Nerenberg To: 9front@9front.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <13483.1611459670.0@orthanc.ca> Date: Sun, 24 Jan 2021 02:28:48 -0800 Message-ID: <1efbedde4f69c2a8@orthanc.ca> List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: virtual converged engine-scale just-in-time-aware optimizer Subject: [9front] news(1) patch: make -a and -n get along Reply-To: 9front@9front.org Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13483.1611459670.1@orthanc.ca> [ I sent this to 9front-bugs but that copy seems to have been swallowed by a black home. ] This patch makes 'news -an' do the right thing. ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13483.1611459670.2@orthanc.ca> /n/dump/2021/0122/sys/src/cmd/news.c:44,65 - news.c:44,72 void main(int argc, char *argv[]) { - int i; + int i, aflag = 0, nflag = 0; + int doupdate = 1; + int printall = 0; + void (*printer)(char*) = print_item; Binit(&bout, 1, OWRITE); if(argc == 1) { - eachitem(print_item, 0, 1); + eachitem(print_item, printall, doupdate); exits(0); } ARGBEGIN{ case 'a': /* print all */ - eachitem(print_item, 1, 0); + doupdate = 0; + printall = 1; + // eachitem(print_item, 1, 0); break; case 'n': /* names only */ - eachitem(note, 0, 0); - if(n_items) - Bputc(&bout, '\n'); + doupdate = 0; + printer = note; + // eachitem(note, 0, 0); + // if(n_items) + // Bputc(&bout, '\n'); break; default: /n/dump/2021/0122/sys/src/cmd/news.c:66,73 - news.c:73,87 fprint(2, "news: bad option %c\n", ARGC()); exits("usage"); }ARGEND - for(i=0; i