mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
Convert %p to 0x%x instead of to 0x%8x. The latter gives blank padding
in the wrong place. Blank padding in the right place or zero padding would be inconsistent with user mode. Put case 'p' in alphabetical order. Implement %p in sprintf() too. I'd like only a single, more complete printf() core, perhaps one based on vsnprintf().
This commit is contained in:
parent
6f5014b462
commit
f53dbe9765
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9224
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
|
||||
* $Id: subr_prf.c,v 1.12 1995/04/01 20:18:43 joerg Exp $
|
||||
* $Id: subr_prf.c,v 1.13 1995/04/08 21:32:11 joerg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -448,17 +448,16 @@ reswitch: switch (ch = *(u_char *)fmt++) {
|
||||
ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int);
|
||||
base = 8;
|
||||
goto number;
|
||||
case 'p':
|
||||
ul = (u_long)va_arg(ap, void *);
|
||||
base = 16;
|
||||
putchar('0', flags, tp);
|
||||
putchar('x', flags, tp);
|
||||
goto number;
|
||||
case 'u':
|
||||
ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int);
|
||||
base = 10;
|
||||
goto number;
|
||||
case 'p':
|
||||
ul = (u_long) va_arg(ap, void *);
|
||||
width=8;
|
||||
base=16;
|
||||
putchar('0',flags,tp);
|
||||
putchar('x',flags,tp);
|
||||
goto number;
|
||||
case 'x':
|
||||
ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int);
|
||||
base = 16;
|
||||
@ -574,6 +573,12 @@ reswitch: switch (ch = *(u_char *)fmt++) {
|
||||
base = 8;
|
||||
goto number;
|
||||
break;
|
||||
case 'p':
|
||||
ul = (u_long)va_arg(ap, void *);
|
||||
base = 16;
|
||||
*bp++ = '0';
|
||||
*bp++ = 'x';
|
||||
goto number;
|
||||
case 'u':
|
||||
ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int);
|
||||
base = 10;
|
||||
|
Loading…
Reference in New Issue
Block a user