Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Feb 1999 10:16:45 +0000 (GMT)
From:      Doug Rabson <dfr@nlsystems.com>
To:        Andy Doran <ad@psn.ie>
Cc:        "Alton, Matthew" <Matthew.Alton@anheuser-busch.com>, "'Hackers@FreeBSD.ORG'" <Hackers@freebsd.org>, "Ladendorf, Matt" <Matt.Ladendorf@anheuser-busch.com>
Subject:   Re: printf wierdness
Message-ID:  <Pine.BSF.4.05.9902271014550.71457-100000@herring.nlsystems.com>
In-Reply-To: <36D70AC8.A862B8C0@psn.ie>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 26 Feb 1999, Andy Doran wrote:

> printf() is treating the %llu type as an unsigned long (%lu), 
> so it's taking the value for %s from the second 32-bits in
> 'foo'. Check the printf(3) manpage.

I would like to change this.  I noticed the problem when building an alpha
cross debugger (hosted on i386, targetted at alpha).  Locally, I have
changed printf to treat "%lld" the same as "%qd":

Index: vfprintf.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/stdio/vfprintf.c,v
retrieving revision 1.20
diff -u -r1.20 vfprintf.c
--- vfprintf.c	1998/09/16 04:17:44	1.20
+++ vfprintf.c	1999/02/20 10:20:08
@@ -545,7 +545,10 @@
 			flags |= SHORTINT;
 			goto rflag;
 		case 'l':
-			flags |= LONGINT;
+			if (flags & LONGINT)
+				flags |= QUADINT;
+			else
+				flags |= LONGINT;
 			goto rflag;
 		case 'q':
 			flags |= QUADINT;
@@ -1016,7 +1019,10 @@
 			flags |= SHORTINT;
 			goto rflag;
 		case 'l':
-			flags |= LONGINT;
+			if (flags & LONGINT)
+				flags |= QUADINT;
+			else
+				flags |= LONGINT;
 			goto rflag;
 		case 'q':
 			flags |= QUADINT;


--
Doug Rabson				Mail:  dfr@nlsystems.com
Nonlinear Systems Ltd.			Phone: +44 181 442 9037




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9902271014550.71457-100000>