Back to index

glibc  2.9
bug8.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <string.h>
00003 
00004 int
00005 main(int argc, char *argv[])
00006 {
00007     char buf[100];
00008     int point, x, y;
00009     int status = 0;
00010 
00011     sscanf("0x10 10", "%x %x", &x, &y);
00012     sprintf(buf, "%d %d", x, y);
00013     puts (buf);
00014     status |= strcmp (buf, "16 16");
00015     sscanf("P012349876", "P%1d%4d%4d", &point, &x, &y);
00016     sprintf(buf, "%d %d %d", point, x, y);
00017     status |= strcmp (buf, "0 1234 9876");
00018     puts (buf);
00019     sscanf("P112349876", "P%1d%4d%4d", &point, &x, &y);
00020     sprintf(buf, "%d %d %d", point, x, y);
00021     status |= strcmp (buf, "1 1234 9876");
00022     puts (buf);
00023 
00024     puts (status ? "Test failed" : "Test passed");
00025 
00026     return status;
00027 }