Handle "%...p" as "%#...x" instead of "0x%...x". This is a quick fix

for field widths being 2 larger than specified for "%<number>p".  Only
printing of null pointers is "wrong" now (it is actually "right", but
inconsistent with printf(3)).
This commit is contained in:
Bruce Evans 1997-12-28 05:03:33 +00:00
parent 09411a5af3
commit f82057be9e
1 changed files with 2 additions and 3 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
* $Id: subr_prf.c,v 1.42 1997/09/02 20:05:51 bde Exp $
* $Id: subr_prf.c,v 1.43 1997/10/12 20:23:58 phk Exp $
*/
#include <sys/param.h>
@ -499,8 +499,7 @@ reswitch: switch (ch = (u_char)*fmt++) {
case 'p':
ul = (u_long)va_arg(ap, void *);
base = 16;
PCHAR('0');
PCHAR('x');
sharpflag = 1;
goto number;
case 's':
p = va_arg(ap, char *);