[Bug 219926] sscanf(3): Inconsistent return value on match failures with patterns like "%*s%u" when compared to other implementations

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Jun 11 16:11:42 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219926

--- Comment #1 from Conrad Meyer <cem at freebsd.org> ---
The C11 standard says:

-------------------------------8<-------------------------------
Returns
3 The sscanf function returns the value of the macro EOF if an input failure
occurs before the first conversion (if any) has completed. Otherwise, the
sscanf function returns the number of input items assigned, which can be fewer
than provided for, or even zero, in the event of an early matching failure.
-------------------------------8<-------------------------------

So the question is — is "%*s" a conversion?

>From the fscanf part of C11:

-------------------------------8<-------------------------------
Each conversion specification is introduced by the character %.
After the %, the following appear in sequence:
— An optional assignment-suppressing character *.
— An optional decimal integer greater than zero that specifies the maximum
field width (in characters).
— An optional length modifier that specifies the size of the receiving object.
— A conversion specifier character that specifies the type of conversion to be
applied.
-------------------------------8<-------------------------------

So... maybe?

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list