xref: /original-bsd/bin/sh/output.h (revision 159d5566)
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.1 (Berkeley) 05/31/93
11  */
12 
13 #ifndef OUTPUT_INCL
14 
15 struct output {
16 	char *nextc;
17 	int nleft;
18 	char *buf;
19 	int bufsize;
20 	short fd;
21 	short flags;
22 };
23 
24 extern struct output output;
25 extern struct output errout;
26 extern struct output memout;
27 extern struct output *out1;
28 extern struct output *out2;
29 
30 
31 #ifdef __STDC__
32 void outstr(char *, struct output *);
33 void out1str(char *);
34 void out2str(char *);
35 void outfmt(struct output *, char *, ...);
36 void out1fmt(char *, ...);
37 void fmtstr(char *, int, char *, ...);
38 /* void doformat(struct output *, char *, va_list); */
39 void doformat();
40 void emptyoutbuf(struct output *);
41 void flushall(void);
42 void flushout(struct output *);
43 void freestdout(void);
44 int xwrite(int, char *, int);
45 int xioctl(int, int, int);
46 #else
47 void outstr();
48 void out1str();
49 void out2str();
50 void outfmt();
51 void out1fmt();
52 void fmtstr();
53 /* void doformat(); */
54 void doformat();
55 void emptyoutbuf();
56 void flushall();
57 void flushout();
58 void freestdout();
59 int xwrite();
60 int xioctl();
61 #endif
62 
63 #define outc(c, file)	(--(file)->nleft < 0? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))
64 #define out1c(c)	outc(c, out1);
65 #define out2c(c)	outc(c, out2);
66 
67 #define OUTPUT_INCL
68 #endif
69