From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11708 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: Sun, 9 Jul 2017 22:00:47 -0400 Message-ID: <20170710020047.GL1627@brightrain.aerifal.cx> References: <20170709210018.16369-1-b.brachaczek@gmail.com> 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 1499652066 9510 195.159.176.226 (10 Jul 2017 02:01:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 10 Jul 2017 02:01:06 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-11721-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jul 10 04:01:00 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 1dUO0P-00020R-IU for gllmg-musl@m.gmane.org; Mon, 10 Jul 2017 04:00:57 +0200 Original-Received: (qmail 1419 invoked by uid 550); 10 Jul 2017 02:01:00 -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 1391 invoked from network); 10 Jul 2017 02:00:59 -0000 Content-Disposition: inline In-Reply-To: <20170709210018.16369-1-b.brachaczek@gmail.com> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:11708 Archived-At: On Sun, Jul 09, 2017 at 11:00:18PM +0200, Bartosz Brachaczek wrote: > this is mandated by C and POSIX standards and is in accordance with ^^^^ > glibc behavior. Can you explain exactly what "this" refers to? > --- > src/stdio/vfscanf.c | 10 +++++++--- > src/stdio/vfwscanf.c | 8 ++++++-- > 2 files changed, 13 insertions(+), 5 deletions(-) > > diff --git a/src/stdio/vfscanf.c b/src/stdio/vfscanf.c > index d4d2454b..9e030fc4 100644 > --- a/src/stdio/vfscanf.c > +++ b/src/stdio/vfscanf.c > @@ -89,15 +89,19 @@ int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap) > continue; > } > if (*p != '%' || p[1] == '%') { > - p += *p=='%'; > shlim(f, 0); > - c = shgetc(f); > + if (*p == '%') { > + p++; > + while (isspace((c=shgetc(f)))); > + } else { > + c = shgetc(f); > + } It looks like you're claiming %% consumes space, which I can't find any support for in the C standard. Has this topic been discussed somewhere I should see? Rich