* Scaled down version of C Library printf.
* Only %s %u %d (==%u) %o %x %D %c are recognized.
* Used to print diagnostic information
* directly on console tty.
* Since it is not interrupt driven,
* all system activities are pretty much
* Printf should not be used for chit-chat.
register unsigned int *adx
;
while((c
= *fmt
++) != '%') {
else if(c
== 'd' || c
== 'u' || c
== 'o' || c
== 'x')
printn((long)*adx
, c
=='o'? 8: (c
=='x'? 16:10));
printn(*(long *)adx
, 10);
adx
+= (sizeof(long) / sizeof(int)) - 1;
putchar("0123456789ABCDEF"[(x
>>((7-i
)*4))&0xf]);
* Print an unsigned integer in base b.
if (n
<0) { /* shouldn't happen */
putchar("0123456789ABCDEF"[(int)(n
%b
)]);
* Print a character on console.
* Attempts to save and restore device
* If the switches are 0, all
* Whether or not printing is inhibited,
* the last MSGBUFS characters
* are saved in msgbuf for inspection later.
* Try waiting for the console tty to come ready,
* otherwise give up after a reasonable time.
while((mfpr(TXCS
)&TXCS_RDY
) == 0)
while((mfpr(RXCS
)&RXCS_DONE
) == 0)
if (lp
!= buf
&& *(lp
-1) == '\\') {