* Scaled down version of C Library printf.
* Used to print diagnostic information directly on console tty.
* Since it is not interrupt driven, all system activities are
* suspended. Printf should not be used for chit-chat.
* One additional format: %b is supported to decode error registers.
* printf("reg=%b\n", regval, "<base><arg>*");
* Where <base> is the output base expressed as a control character,
* e.g. \10 gives octal; \20 gives hex. Each arg is a sequence of
* characters, the first of which gives the bit number to be inspected
* (origin 1), and the next characters (up to a control character, i.e.
* a character <= 32), give the name of the register. Thus
* printf("reg=%b\n", 3, "\10\2BITTWO\1BITONE\n");
while ((c
= *fmt
++) != '%') {
/* THIS CODE IS VAX DEPENDENT IN HANDLING %l? AND %c */
case 'u': /* what a joke */
for (i
= 24; i
>= 0; i
-= 8)
for (; (c
= *s
) > 32; s
++)
* Printn prints a number n in base b.
* We don't use recursion to avoid deep kernel stacks.
if (b
== 10 && (int)n
< 0) {
*cp
++ = "0123456789abcdef"[n
%b
];
* Print a character on console.
* Attempts to save and restore device
* 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)