1 #include <u.h> 2 #include <libc.h> 3 #include "iotrack.h" 4 #include "dat.h" 5 #include "fns.h" 6 7 #define SIZE 1024 8 #define DOTDOT (&fmt+1) 9 10 int chatty; 11 12 void 13 chat(char *fmt, ...) 14 { 15 char buf[SIZE], *out; 16 17 if (!chatty) 18 return; 19 20 out = doprint(buf, buf+SIZE, fmt, DOTDOT); 21 write(2, buf, (long)(out-buf)); 22 } 23 24 void 25 panic(char *fmt, ...) 26 { 27 char buf[SIZE]; int n; 28 29 n = sprint(buf, "%s %d: ", argv0, getpid()); 30 doprint(buf+n, buf+SIZE-n, fmt, DOTDOT); 31 perror(buf); 32 exits("panic"); 33 } 34