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"):

  [...] 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 ..."

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.18-4-686-bigmem (SMP w/2 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.ISO8859-1 (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages manpages-dev depends on:
ii  manpages                      2.62-1     Manual pages about using a GNU/Lin

manpages-dev recommends no packages.

-- no debconf information

Reply via email to