File: bug-21905-scanf_flt.c

package info (click to toggle)
avr-libc 1%3A1.6.2.cvs20080610-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 14,848 kB
  • ctags: 55,619
  • sloc: ansic: 92,267; asm: 6,692; sh: 4,131; makefile: 2,481; python: 976; pascal: 426; perl: 116
file content (20 lines) | stat: -rw-r--r-- 536 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* bug #21905: scanf: float conversion ignores the suppression symbol
   $Id: bug-21905-scanf_flt.c,v 1.1.2.2 2008/02/23 09:03:53 dmix Exp $	*/

#include <stdio.h>
#include <string.h>

int main ()
{
    /* Use function pointer to avoid compiler warning.	*/
    int (* volatile pf) (const char *, const char *, ...) = sscanf;
    float x, y;
    int i;

    y = 0;
    i = pf ("1.2345 6.7", "%e %*e", &x, &y);
    if (i == 0) return __LINE__;	/* Are you use float version?	*/
    if ((i != 1) || y) return __LINE__;
    
    return 0;
}