147138Sbostic /*- 260698Sbostic * Copyright (c) 1991, 1993 360698Sbostic * The Regents of the University of California. All rights reserved. 447138Sbostic * 547138Sbostic * This code is derived from software contributed to Berkeley by 647138Sbostic * Kenneth Almquist. 747138Sbostic * 847138Sbostic * %sccs.include.redist.c% 947138Sbostic * 10*69272Schristos * @(#)output.h 8.2 (Berkeley) 05/04/95 1147138Sbostic */ 1247138Sbostic 1347138Sbostic #ifndef OUTPUT_INCL 1447138Sbostic 15*69272Schristos #if __STDC__ 16*69272Schristos #include <stdarg.h> 17*69272Schristos #else 18*69272Schristos #include <varargs.h> 19*69272Schristos #endif 20*69272Schristos 2147138Sbostic struct output { 2247138Sbostic char *nextc; 2347138Sbostic int nleft; 2447138Sbostic char *buf; 2547138Sbostic int bufsize; 2647138Sbostic short fd; 2747138Sbostic short flags; 2847138Sbostic }; 2947138Sbostic 3047138Sbostic extern struct output output; 3147138Sbostic extern struct output errout; 3247138Sbostic extern struct output memout; 3347138Sbostic extern struct output *out1; 3447138Sbostic extern struct output *out2; 3547138Sbostic 36*69272Schristos void open_mem __P((char *, int, struct output *)); 37*69272Schristos void out1str __P((const char *)); 38*69272Schristos void out2str __P((const char *)); 39*69272Schristos void outstr __P((const char *, struct output *)); 40*69272Schristos void emptyoutbuf __P((struct output *)); 41*69272Schristos void flushall __P((void)); 42*69272Schristos void flushout __P((struct output *)); 43*69272Schristos void freestdout __P((void)); 44*69272Schristos void outfmt __P((struct output *, char *, ...)); 45*69272Schristos void out1fmt __P((char *, ...)); 46*69272Schristos void dprintf __P((char *, ...)); 47*69272Schristos void fmtstr __P((char *, int, char *, ...)); 48*69272Schristos void doformat __P((struct output *, char *, va_list)); 49*69272Schristos int xwrite __P((int, char *, int)); 50*69272Schristos int xioctl __P((int, unsigned long, char *)); 5147138Sbostic 5247138Sbostic #define outc(c, file) (--(file)->nleft < 0? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c))) 5347138Sbostic #define out1c(c) outc(c, out1); 5447138Sbostic #define out2c(c) outc(c, out2); 5547138Sbostic 5647138Sbostic #define OUTPUT_INCL 5747138Sbostic #endif 58