apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jerenkra...@ebuilt.com>
Subject [REPOST] printf and FMT values.
Date Sat, 28 Apr 2001 05:48:38 GMT
The essence of my original post at:

http://www.apachelabs.org/apr-mbox/200104.mbox/%3c20010422090728.B28344@ebuilt.com%3e

was:

Should APR_<FOO>_T_FMT (FOO = INT64, OFF, PID, etc) be compatible
with the OS printf() calls or should they only work with apr_snprintf?

Solaris printf uses "%lld" for long long, but apr_snprintf doesn't 
recognize that as a valid format string - it uses "%qd".

No one has replied yet.  I've been using the following patch locally 
until a definitive answer is given - this works for me (TM).  

Thanks.  -- justin

Index: strings/apr_snprintf.c
===================================================================
RCS file: /home/cvspublic/apr/strings/apr_snprintf.c,v
retrieving revision 1.14
diff -u -r1.14 apr_snprintf.c
--- strings/apr_snprintf.c	2001/04/27 18:36:06	1.14
+++ strings/apr_snprintf.c	2001/04/28 05:44:18
@@ -814,6 +814,11 @@
 	    else if (*fmt == 'l') {
 		var_type = IS_LONG;
 		fmt++;
+        if (*fmt == 'l')
+        {
+            var_type = IS_QUAD;
+		    fmt++;
+        }
 	    }
 	    else if (*fmt == 'h') {
 		var_type = IS_SHORT;


Mime
View raw message