/* subr_prf.c 4.10 %G% */
* In case console is off,
* panicstr contains argument to last
* Scaled down version of C Library printf.
* Only %s %u %d (==%u) %o %x %D 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.
* print to the current users terminal,
* guarantee not to sleep (so can be called by intr routine)
* no watermark checking - so no verbose messages
/* THIS CODE IS VAX DEPENDENT */
while ((c
= *fmt
++) != '%') {
case 'u': /* what a joke */
for (i
= 24; i
>= 0; i
-= 8)
for (; (c
= *s
) > 32; s
++)
/* END VAX DEPENDENT CODE */
if (b
== 10 && (int)n
< 0) {
*cp
++ = "0123456789abcdef"[n
%b
];
* Panic is called on unresolvable fatal errors.
* It syncs, prints "panic: mesg", and then reboots.
printf("panic: %s\n", s
);
boot(RB_PANIC
, RB_AUTOBOOT
);
* prdev prints a warning message of the
* form "mesg on dev x/y".
* x and y are the major and minor parts of
printf("%s on dev %d/%d\n", str
, major(dev
), minor(dev
));
printf("hard err bn %d ", bp
->b_blkno
);
* Print a character on console or users terminal.
* If destination is console then the last MSGBUFS characters
* are saved in msgbuf for inspection later.
register struct tty
*tp
= u
.u_ttyp
;
if (tp
&& (tp
->t_state
&CARR_ON
)) {
if (c
!= '\0' && c
!= '\r' && c
!= 0177 && mfpr(MAPEN
)) {
if (msgbuf
.msg_magic
!= MSG_MAGIC
) {
msgbuf
.msg_magic
= MSG_MAGIC
;
if (msgbuf
.msg_bufx
< 0 || msgbuf
.msg_bufx
>= MSG_BSIZE
)
msgbuf
.msg_bufc
[msgbuf
.msg_bufx
++] = c
;