tags 435648 fixed-upstream
thanks

fixed in upstream 3.04.

Hello Vincent,

Vincent Lefevre wrote:
Package: manpages-dev
Version: 2.62-1
Severity: normal

The scanf man page says:

  ยท  An  optional  decimal  integer which specifies the maximum field
     width.  Reading of characters stops either when this maximum  is
     reached  or  when  a  non-matching character is found, whichever
     happens first.   Most  conversions  discard  initial  whitespace
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     characters (the exceptions are noted below), and these discarded
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     characters don't count towards the maximum field width.   String
     input conversions store a null terminator ('\0') to mark the end
     of the input; the maximum field width does not include this ter-
     minator.

and

  The following conversion specifiers are available:

  %  Matches a literal '%'.  That is, %% in the format string matches
     a  single  input  '%'  character.   No  conversion  is done, and
                                         ^^^^^^^^^^^^^^^^^^^^^^^
     assignment does not occur.

So, one may think that since %% doesn't do a conversion, initial
whitespace is not discarded. But this is incorrect: initial whitespace
is discarded (as required by the ISO C standard). The C standard has
better wording ("conversion specification" instead of "conversion"):

Interestingly, the wording of the man page is quite close to the
POSIX.1 spec:
    %      Matches a single '%' character; no conversion or assignment
           occurs. The complete conversion specification shall be %% .

  [...] A conversion specification is executed in the following steps:
                     ^^^^^^^^^^^^^

  Input white-space characters (as specified by the isspace function)
  are skipped, unless the specification includes a [, c, or n specifier.

The scanf man page should probably say: "... Most conversion
specifications discard initial whitespace characters ..."

I prefer to be more explicit.  For the description of %% I changed
the text to:

    No conversion is done (but initial white space characters are
    discarded), and assignment does not occur.

okay?

Cheers,

Michael

--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html





--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to