12 printint(int fd
, int xx
, int base
, int sgn
)
14 static char digits
[] = "0123456789ABCDEF";
29 buf
[i
++] = digits
[x
% base
];
30 }while((x
/= base
) != 0);
38 // Print to the given fd. Only understands %d, %x, %p, %s.
40 printf(int fd
, char *fmt
, ...)
47 ap
= (uint
*)(void*)&fmt
+ 1;
48 for(i
= 0; fmt
[i
]; i
++){
56 } else if(state
== '%'){
58 printint(fd
, *ap
, 10, 1);
60 } else if(c
== 'x' || c
== 'p'){
61 printint(fd
, *ap
, 16, 0);
78 // Unknown % sequence. Print it to draw attention.