1 #define EOF (-1) 2 #define pchr(b, c) ((b)->bufp==(b)->ebuf?fullbuf((b), (c)):(*(b)->bufp++=(c))) 3 #define rchr(b) ((b)->bufp==(b)->ebuf?emptybuf(b):(*(b)->bufp++&0xff)) 4 #define NBUF 512 5 typedef struct io io; 6 struct io{ 7 int fd; 8 char *bufp, *ebuf, *strp, buf[NBUF]; 9 }; 10 io *err; 11 io *openfd(int), *openstr(void), *opencore(char *, int); 12 int emptybuf(io*); 13 void closeio(io*); 14 void flush(io*); 15 int fullbuf(io*, int); 16 void pdec(io*, long); 17 void poct(io*, ulong); 18 void phex(io*, long); 19 void pquo(io*, char*); 20 void pwrd(io*, char*); 21 void pstr(io*, char*); 22 void pcmd(io*, tree*); 23 void pval(io*, word*); 24 void pfnc(io*, thread*); 25 void pfmt(io*, char*, ...); 26