* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
* Redistribution is only permitted until one year after the first shipment
* of 4.4BSD by the Regents. Otherwise, redistribution and use in source and
* binary forms are permitted provided that: (1) source distributions retain
* this entire copyright notice and comment, and (2) distributions including
* binaries display the following acknowledgement: This product includes
* software developed by the University of California, Berkeley and its
* contributors'' in the documentation or other materials provided with the
* distribution and in all advertising materials mentioning features or use
* of this software. Neither the name of the University nor the names of
* its contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* @(#)prf.c 7.2 (Berkeley) 6/24/90
* 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 */
printn(userom
, (u_long
)*adx
, b
);
for (i
= 24; i
>= 0; i
-= 8)
printn(userom
, (u_long
)b
, *s
++);
putchar(userom
, any
? ',' : '<');
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.
while((c
= cngetc()) == 0)
else if (c
== ('c'&037)) {