|
|
| version 1.2, 2003/06/17 04:26:46 | version 1.3, 2004/03/08 07:55:57 |
|---|---|
| Line 35 | Line 35 |
| * | * |
| * @(#)vfscanf.c 8.1 (Berkeley) 6/4/93 | * @(#)vfscanf.c 8.1 (Berkeley) 6/4/93 |
| * $FreeBSD: src/lib/libc/stdio/vfscanf.c,v 1.14.2.2 2002/04/17 14:58:23 ache Exp $ | * $FreeBSD: src/lib/libc/stdio/vfscanf.c,v 1.14.2.2 2002/04/17 14:58:23 ache Exp $ |
| * $DragonFly: src/lib/libc/stdio/vfscanf.c,v 1.1 2003/06/16 04:34:26 dillon Exp $ | * $DragonFly$ |
| */ | */ |
| #include <stdio.h> | #include <stdio.h> |
| Line 84 | Line 84 |
| #define PFXOK 0x100 /* 0x prefix is (still) legal */ | #define PFXOK 0x100 /* 0x prefix is (still) legal */ |
| #define NZDIGITS 0x200 /* no zero digits detected */ | #define NZDIGITS 0x200 /* no zero digits detected */ |
| #define HAVESIGN 0x10000 /* sign detected */ | |
| /* | /* |
| * Conversion types. | * Conversion types. |
| Line 502 literal: | Line 503 literal: |
| case '+': case '-': | case '+': case '-': |
| if (flags & SIGNOK) { | if (flags & SIGNOK) { |
| flags &= ~SIGNOK; | flags &= ~SIGNOK; |
| flags |= HAVESIGN; | |
| goto ok; | goto ok; |
| } | } |
| break; | break; |
| /* x ok iff flag still set & 2nd char */ | /* |
| * x ok iff flag still set & 2nd char (or | |
| * 3rd char if we have a sign). | |
| */ | |
| case 'x': case 'X': | case 'x': case 'X': |
| if (flags & PFXOK && p == buf + 1) { | if (flags & PFXOK && p == |
| buf + 1 + !!(flags & HAVESIGN)) { | |
| base = 16; /* if %i */ | base = 16; /* if %i */ |
| flags &= ~PFXOK; | flags &= ~PFXOK; |
| goto ok; | goto ok; |