xref: /original-bsd/bin/sh/output.h (revision 0842ddeb)
1 /*-
2  * Copyright (c) 1991, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Kenneth Almquist.
7  *
8  * %sccs.include.redist.c%
9  *
10  *	@(#)output.h	8.2 (Berkeley) 05/04/95
11  */
12 
13 #ifndef OUTPUT_INCL
14 
15 #if __STDC__
16 #include <stdarg.h>
17 #else
18 #include <varargs.h>
19 #endif
20 
21 struct output {
22 	char *nextc;
23 	int nleft;
24 	char *buf;
25 	int bufsize;
26 	short fd;
27 	short flags;
28 };
29 
30 extern struct output output;
31 extern struct output errout;
32 extern struct output memout;
33 extern struct output *out1;
34 extern struct output *out2;
35 
36 void open_mem __P((char *, int, struct output *));
37 void out1str __P((const char *));
38 void out2str __P((const char *));
39 void outstr __P((const char *, struct output *));
40 void emptyoutbuf __P((struct output *));
41 void flushall __P((void));
42 void flushout __P((struct output *));
43 void freestdout __P((void));
44 void outfmt __P((struct output *, char *, ...));
45 void out1fmt __P((char *, ...));
46 void dprintf __P((char *, ...));
47 void fmtstr __P((char *, int, char *, ...));
48 void doformat __P((struct output *, char *, va_list));
49 int xwrite __P((int, char *, int));
50 int xioctl __P((int, unsigned long, char *));
51 
52 #define outc(c, file)	(--(file)->nleft < 0? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))
53 #define out1c(c)	outc(c, out1);
54 #define out2c(c)	outc(c, out2);
55 
56 #define OUTPUT_INCL
57 #endif
58