apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <...@covalent.net>
Subject Re: [REPOST] printf and FMT values.
Date Sat, 28 Apr 2001 15:16:04 GMT

There is no need for apr_*printf formats to be compatible with OS printf
calls.  We have re-implemented apr_*printf because we needed better
portability.  In reality, that means that we could easily just define a
single set of format strings.

Ryan

On Fri, 27 Apr 2001, Justin Erenkrantz wrote:

> 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;
>
>


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Mime
View raw message