xref: /csrg-svn/bin/sh/output.h (revision 60698)
147138Sbostic /*-
2*60698Sbostic  * Copyright (c) 1991, 1993
3*60698Sbostic  *	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*60698Sbostic  *	@(#)output.h	8.1 (Berkeley) 05/31/93
1147138Sbostic  */
1247138Sbostic 
1347138Sbostic #ifndef OUTPUT_INCL
1447138Sbostic 
1547138Sbostic struct output {
1647138Sbostic 	char *nextc;
1747138Sbostic 	int nleft;
1847138Sbostic 	char *buf;
1947138Sbostic 	int bufsize;
2047138Sbostic 	short fd;
2147138Sbostic 	short flags;
2247138Sbostic };
2347138Sbostic 
2447138Sbostic extern struct output output;
2547138Sbostic extern struct output errout;
2647138Sbostic extern struct output memout;
2747138Sbostic extern struct output *out1;
2847138Sbostic extern struct output *out2;
2947138Sbostic 
3047138Sbostic 
3147138Sbostic #ifdef __STDC__
3247138Sbostic void outstr(char *, struct output *);
3347138Sbostic void out1str(char *);
3447138Sbostic void out2str(char *);
3547138Sbostic void outfmt(struct output *, char *, ...);
3647138Sbostic void out1fmt(char *, ...);
3747138Sbostic void fmtstr(char *, int, char *, ...);
3847138Sbostic /* void doformat(struct output *, char *, va_list); */
3947138Sbostic void doformat();
4047138Sbostic void emptyoutbuf(struct output *);
4147138Sbostic void flushall(void);
4247138Sbostic void flushout(struct output *);
4347138Sbostic void freestdout(void);
4447138Sbostic int xwrite(int, char *, int);
4547138Sbostic int xioctl(int, int, int);
4647138Sbostic #else
4747138Sbostic void outstr();
4847138Sbostic void out1str();
4947138Sbostic void out2str();
5047138Sbostic void outfmt();
5147138Sbostic void out1fmt();
5247138Sbostic void fmtstr();
5347138Sbostic /* void doformat(); */
5447138Sbostic void doformat();
5547138Sbostic void emptyoutbuf();
5647138Sbostic void flushall();
5747138Sbostic void flushout();
5847138Sbostic void freestdout();
5947138Sbostic int xwrite();
6047138Sbostic int xioctl();
6147138Sbostic #endif
6247138Sbostic 
6347138Sbostic #define outc(c, file)	(--(file)->nleft < 0? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))
6447138Sbostic #define out1c(c)	outc(c, out1);
6547138Sbostic #define out2c(c)	outc(c, out2);
6647138Sbostic 
6747138Sbostic #define OUTPUT_INCL
6847138Sbostic #endif
69