From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH] handle whitespace before %% in scanf
Date: Sun, 9 Jul 2017 22:00:47 -0400 [thread overview]
Message-ID: <20170710020047.GL1627@brightrain.aerifal.cx> (raw)
In-Reply-To: <20170709210018.16369-1-b.brachaczek@gmail.com>
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
next prev parent reply other threads:[~2017-07-10 2:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-09 21:00 Bartosz Brachaczek
2017-07-10 2:00 ` Rich Felker [this message]
2017-07-10 8:22 ` Bartosz Brachaczek
2017-07-10 14:44 ` Jens Gustedt
2017-07-10 20:59 ` Rich Felker
2017-09-04 22:00 ` Bartosz Brachaczek
2017-09-04 22:57 ` Jens Gustedt
2017-07-11 1:20 ` Rich Felker
2017-09-04 20:59 ` Rich Felker
2017-09-04 21:56 ` Bartosz Brachaczek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170710020047.GL1627@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).