From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2425 invoked by alias); 23 Dec 2017 15:01:53 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42160 Received: (qmail 15649 invoked by uid 1010); 23 Dec 2017 15:01:53 -0000 X-Qmail-Scanner-Diagnostics: from aok120.rev.netart.pl by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(85.128.245.120):SA:0(-1.9/5.0):. Processed in 11.19731 secs); 23 Dec 2017 15:01:53 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: psprint@zdharma.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new using ClamAV (10) Date: Sat, 23 Dec 2017 16:01:38 +0100 From: Sebastian Gniazdowski To: Zsh hackers list , Peter Stephenson Message-ID: In-Reply-To: <20170619215237.7e58707b@ntlworld.com> References: <20170619122413.GA9294@chaz.gmail.com> <170619083116.ZM17323__41722.0601499595$1497886320$gmane$org@torch.brasslantern.com> <20170619161601.GB9294@chaz.gmail.com> <20170619202835.7f207185@ntlworld.com> <20170619215237.7e58707b@ntlworld.com> Subject: Re: Why sourcing a file is not faster than doing a loop with eval, zle -N X-Mailer: Airmail (442) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline On 19 czerwca 2017 at 22:52:37, Peter Stephenson (p.w.stephenson@ntlworld.com) wrote: > On Mon, 19 Jun 2017 20:28:35 +0100 > Peter Stephenson wrote: > > How about something like this? As far as I can tell, fgets is designed > > from the ground up as Gets Done Properly, so if you have it on your > > system it will work correctly. I can't think of a case where this > > wouldn't do the right thing --- fgets will read at most one line and if > > it does we were going to get the big STDIO overhead at that point > > anyway. > > I know what the problem with it is --- we can't tell the difference > betwen a terminating '\0' and a '\0' that's part of the input stream. We could do a pair of calls, first fgets(), then fgetc(), and this way solve this problem? -- Sebastian Gniazdowski psprint /at/ zdharma.org