Date: Fri, 9 Aug 2013 01:40:02 GMT From: Andrey Chernov <ache@freebsd.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/181153: sscanf doesn't skip whitespace properly Message-ID: <201308090140.r791e2T8037518@freefall.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR kern/181153; it has been noted by GNATS.
From: Andrey Chernov <ache@freebsd.org>
To: Garrett Cooper <yaneurabeya@gmail.com>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/181153: sscanf doesn't skip whitespace properly
Date: Fri, 09 Aug 2013 05:24:20 +0400
On 09.08.2013 4:23, Garrett Cooper wrote:
> ATF_TC_BODY(sscanf_whitespace, tc)
> {
> const char str[] = "\f\n\r\t\v%z";
> char c;
>
> /* set of "white space" symbols from isspace(3) */
> c = 0;
> (void)sscanf(str, "%%%c", &c);
> ATF_REQUIRE(c == 'z');
> }
I doubt this exampe should skip whitespace. POSIX says:
"A directive that is an ordinary character shall be executed as follows:
the next byte shall be read from the input and compared with the byte
that comprises the directive; if the comparison shows that they are not
equivalent, the directive shall fail, and the differing and subsequent
bytes shall remain unread."
%% is the ordinary % character and no isspace(3) skipping mentioned in
this explanation.
--
http://ache.vniz.net/
bitcoin:1G6ugdNY6e5jx1GVnAU2ntj2NEfmjKG85r
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308090140.r791e2T8037518>
