Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Feb 2001 10:10:02 -0800 (PST)
From:      Rolf Grossmann <grossman@securitas.net>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: misc/19994: sscanf() fails on 64-bit operations
Message-ID:  <200102181810.f1IIA2Q74505@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/19994; it has been noted by GNATS.

From: Rolf Grossmann <grossman@securitas.net>
To: freebsd-gnats-submit@FreeBSD.org, j_guojun@lbl.gov
Cc:  
Subject: Re: misc/19994: sscanf() fails on 64-bit operations
Date: Sun, 18 Feb 2001 19:04:05 +0100 (CET)

 Hi,
 
 I really think we should support %lld with *scanf. After all, we support
 it with *printf. It bit me when trying to compile the latest ORBit (0.5.7).
 Here's a patch that does the trick.
 
 Bye, Rolf
 
 Index: stdio/vfscanf.c
 ===================================================================
 RCS file: /home/ncvs/src/lib/libc/stdio/vfscanf.c,v
 retrieving revision 1.14
 diff -c -r1.14 vfscanf.c
 *** stdio/vfscanf.c	1999/08/28 00:01:20	1.14
 --- stdio/vfscanf.c	2001/02/18 18:03:04
 ***************
 *** 165,171 ****
   			flags |= SUPPRESS;
   			goto again;
   		case 'l':
 ! 			flags |= LONG;
   			goto again;
   		case 'q':
   			flags |= QUAD;
 --- 165,174 ----
   			flags |= SUPPRESS;
   			goto again;
   		case 'l':
 ! 			if (flags & LONG)
 ! 				flags |= QUAD;
 ! 			else
 ! 				flags |= LONG;
   			goto again;
   		case 'q':
   			flags |= QUAD;
 ***************
 *** 265,276 ****
   			nconversions++;
   			if (flags & SUPPRESS)	/* ??? */
   				continue;
 ! 			if (flags & SHORT)
 ! 				*va_arg(ap, short *) = nread;
   			else if (flags & LONG)
   				*va_arg(ap, long *) = nread;
 ! 			else if (flags & QUAD)
 ! 				*va_arg(ap, quad_t *) = nread;
   			else
   				*va_arg(ap, int *) = nread;
   			continue;
 --- 268,279 ----
   			nconversions++;
   			if (flags & SUPPRESS)	/* ??? */
   				continue;
 ! 			if (flags & QUAD)
 ! 				*va_arg(ap, quad_t *) = nread;
   			else if (flags & LONG)
   				*va_arg(ap, long *) = nread;
 ! 			else if (flags & SHORT)
 ! 				*va_arg(ap, short *) = nread;
   			else
   				*va_arg(ap, int *) = nread;
   			continue;
 ***************
 *** 555,566 ****
   				if (flags & POINTER)
   					*va_arg(ap, void **) =
   						(void *)(u_long)res;
 - 				else if (flags & SHORT)
 - 					*va_arg(ap, short *) = res;
 - 				else if (flags & LONG)
 - 					*va_arg(ap, long *) = res;
   				else if (flags & QUAD)
   					*va_arg(ap, quad_t *) = res;
   				else
   					*va_arg(ap, int *) = res;
   				nassigned++;
 --- 558,569 ----
   				if (flags & POINTER)
   					*va_arg(ap, void **) =
   						(void *)(u_long)res;
   				else if (flags & QUAD)
   					*va_arg(ap, quad_t *) = res;
 + 				else if (flags & LONG)
 + 					*va_arg(ap, long *) = res;
 + 				else if (flags & SHORT)
 + 					*va_arg(ap, short *) = res;
   				else
   					*va_arg(ap, int *) = res;
   				nassigned++;
 


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?200102181810.f1IIA2Q74505>