Date: Wed, 6 Feb 2002 21:11:59 -0500 (EST) From: Chuck Cranor <chuck@research.att.com> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/34682: scanf/sscanf doesn't understand %lld Message-ID: <200202070211.g172Bxc97149@cdn3.research.att.com>
next in thread | raw e-mail | index | archive | help
>Number: 34682
>Category: bin
>Synopsis: scanf/sscanf doesn't understand %lld
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Feb 06 18:20:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Chuck Cranor
>Release: FreeBSD 4.4-STABLE i386
>Organization:
at&t labs-research
>Environment:
System: FreeBSD cdn3.research.att.com 4.4-STABLE FreeBSD 4.4-STABLE #0: Mon Dec 3 14:12:23 EST 2001 chuck@cdn3.research.att.com:/usr/home/chuck/freebsd/44s-kern/src/sys/compile/RESEARCH i386
>Description:
scanf/sscanf doesn't understand %lld, %qd works ok.
>How-To-Repeat:
cdn3[64]> cat tp.c
#include <stdio.h>
#include <sys/types.h>
main() {
u_int64_t q = 0;
sscanf("4354736128", "%lld", &q);
printf("%lld\n", q);
}
cdn3[65]> cc -O -o tp tp.c
cdn3[66]> ./tp
59768832
cdn3[67]>
>Fix:
pull up rev 1.14 of lib/libc/stdio/vfscanf.c from NetBSD CVS repository.
It would be great if this could be fixed in the 4.x stable branch too.
RCS file: /cvsroot/basesrc/lib/libc/stdio/vfscanf.c,v
----------------------------
revision 1.14
date: 1995/03/22 00:57:02; author: jtc; state: Exp; lines: +8 -3
Added "long long" support %ll{d,x,o,i}.
=============================================================================
Index: vfscanf.c
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/stdio/vfscanf.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -c -r1.13 -r1.14
*** vfscanf.c 1995/02/25 07:02:16 1.13
--- vfscanf.c 1995/03/22 00:57:02 1.14
***************
*** 172,178 ****
flags |= SHORT;
goto again;
case 'l':
! flags |= LONG;
goto again;
case 'q':
flags |= QUAD;
--- 172,183 ----
flags |= SHORT;
goto again;
case 'l':
! if (*fmt == 'l') {
! fmt++;
! flags |= QUAD;
! } else {
! flags |= LONG;
! }
goto again;
case 'q':
flags |= QUAD;
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202070211.g172Bxc97149>
