From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11717 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] handle whitespace before %% in scanf Date: Mon, 10 Jul 2017 16:59:55 -0400 Message-ID: <20170710205955.GN1627@brightrain.aerifal.cx> References: <20170709210018.16369-1-b.brachaczek@gmail.com> <20170710020047.GL1627@brightrain.aerifal.cx> <20170710164445.53ef621d@inria.fr> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1499720410 15708 195.159.176.226 (10 Jul 2017 21:00:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 10 Jul 2017 21:00:10 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-11730-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jul 10 23:00:07 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dUfmo-0003sv-Fi for gllmg-musl@m.gmane.org; Mon, 10 Jul 2017 23:00:06 +0200 Original-Received: (qmail 11315 invoked by uid 550); 10 Jul 2017 21:00:08 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 11297 invoked from network); 10 Jul 2017 21:00:08 -0000 Content-Disposition: inline In-Reply-To: <20170710164445.53ef621d@inria.fr> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:11717 Archived-At: On Mon, Jul 10, 2017 at 04:44:45PM +0200, Jens Gustedt wrote: > Hello Bartosz, > > On Mon, 10 Jul 2017 10:22:37 +0200 Bartosz Brachaczek > wrote: > > > > EXAMPLE 5 The call: > > > > > > #include > > > /* ... */ > > > int n, i; > > > n = sscanf("foo % bar 42", "foo%%bar%d", &i); > > > > > > will assign to 'n' the value 1 and to 'i' the value 42 because input > > > white-space characters are skipped for both the '%' and 'd' > > > conversion specifiers. > > > > Now, the code in the example is clearly broken, as either the format > > string should be "foo%% bar%d" or the input string should be > > "foo %bar 42", but the explanation does imply that '%%' consumes > > whitespace. > > Yes, I have noted this as an editorial fix for C17 So you can confirm that it's intentional that %% consume space? That seems utterly awful but I guess you can use %*1[%] in place of %% to do what %% should... Rich