summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2004-01-31 23:18:53 +0000
committerdas <das@FreeBSD.org>2004-01-31 23:18:53 +0000
commita3a1377ebf68392ccb24e2915b021e335f384c89 (patch)
treed4203c2f600829fc5368ddff56d50d3e8dd75acb /lib
parentf042400fb5e8891dbb1c99b58015fd71e22d9cb5 (diff)
downloadFreeBSD-src-a3a1377ebf68392ccb24e2915b021e335f384c89.zip
FreeBSD-src-a3a1377ebf68392ccb24e2915b021e335f384c89.tar.gz
Merge vfscanf.c,v 1.35.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdio/vfwscanf.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/libc/stdio/vfwscanf.c b/lib/libc/stdio/vfwscanf.c
index 3cb6adc..9cc67ac 100644
--- a/lib/libc/stdio/vfwscanf.c
+++ b/lib/libc/stdio/vfwscanf.c
@@ -39,7 +39,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
-__FBSDID("FreeBSD: src/lib/libc/stdio/vfscanf.c,v 1.32 2003/06/28 09:03:05 das Exp ");
+__FBSDID("FreeBSD: src/lib/libc/stdio/vfscanf.c,v 1.35 2004/01/31 23:16:09 das Exp ");
#endif
__FBSDID("$FreeBSD$");
@@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$");
#define NDIGITS 0x80 /* no digits detected */
#define PFXOK 0x100 /* 0x prefix is (still) legal */
#define NZDIGITS 0x200 /* no zero digits detected */
+#define HAVESIGN 0x10000 /* sign detected */
/*
* Conversion types.
@@ -603,13 +604,18 @@ literal:
case '+': case '-':
if (flags & SIGNOK) {
flags &= ~SIGNOK;
+ flags |= HAVESIGN;
goto ok;
}
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':
- if (flags & PFXOK && p == buf + 1) {
+ if (flags & PFXOK && p ==
+ buf + 1 + !!(flags & HAVESIGN)) {
base = 16; /* if %i */
flags &= ~PFXOK;
goto ok;
OpenPOWER on IntegriCloud