type
[unix-history] / usr / src / bin / sh / output.h
CommitLineData
a11a8245
KB
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * 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 5.1 (Berkeley) %G%
11 */
12
13#ifndef OUTPUT_INCL
14
15struct output {
16 char *nextc;
17 int nleft;
18 char *buf;
19 int bufsize;
20 short fd;
21 short flags;
22};
23
24extern struct output output;
25extern struct output errout;
26extern struct output memout;
27extern struct output *out1;
28extern struct output *out2;
29
30
31#ifdef __STDC__
32void outstr(char *, struct output *);
33void out1str(char *);
34void out2str(char *);
35void outfmt(struct output *, char *, ...);
36void out1fmt(char *, ...);
37void fmtstr(char *, int, char *, ...);
38/* void doformat(struct output *, char *, va_list); */
39void doformat();
40void emptyoutbuf(struct output *);
41void flushall(void);
42void flushout(struct output *);
43void freestdout(void);
44int xwrite(int, char *, int);
45int xioctl(int, int, int);
46#else
47void outstr();
48void out1str();
49void out2str();
50void outfmt();
51void out1fmt();
52void fmtstr();
53/* void doformat(); */
54void doformat();
55void emptyoutbuf();
56void flushall();
57void flushout();
58void freestdout();
59int xwrite();
60int 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