output.h (348238dbd42306d9fb5d89ab393b840572cfeb0f) | output.h (5183ddf2ed56519b669320095ed00528a71a9393) |
---|---|
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 * Redistribution and use in source and binary forms, with or without --- 26 unchanged lines hidden (view full) --- 35 36#ifndef OUTPUT_INCL 37 38#include <stdarg.h> 39#include <stddef.h> 40 41struct output { 42 char *nextc; | 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 * Redistribution and use in source and binary forms, with or without --- 26 unchanged lines hidden (view full) --- 35 36#ifndef OUTPUT_INCL 37 38#include <stdarg.h> 39#include <stddef.h> 40 41struct output { 42 char *nextc; |
43 int nleft; | 43 char *bufend; |
44 char *buf; 45 int bufsize; 46 short fd; 47 short flags; 48}; 49 50extern struct output output; /* to fd 1 */ 51extern struct output errout; /* to fd 2 */ --- 18 unchanged lines hidden (view full) --- 70void outclearerror(struct output *); 71void outfmt(struct output *, const char *, ...) __printflike(2, 3); 72void out1fmt(const char *, ...) __printflike(1, 2); 73void out2fmt_flush(const char *, ...) __printflike(1, 2); 74void fmtstr(char *, int, const char *, ...) __printflike(3, 4); 75void doformat(struct output *, const char *, va_list) __printflike(2, 0); 76int xwrite(int, const char *, int); 77 | 44 char *buf; 45 int bufsize; 46 short fd; 47 short flags; 48}; 49 50extern struct output output; /* to fd 1 */ 51extern struct output errout; /* to fd 2 */ --- 18 unchanged lines hidden (view full) --- 70void outclearerror(struct output *); 71void outfmt(struct output *, const char *, ...) __printflike(2, 3); 72void out1fmt(const char *, ...) __printflike(1, 2); 73void out2fmt_flush(const char *, ...) __printflike(1, 2); 74void fmtstr(char *, int, const char *, ...) __printflike(3, 4); 75void doformat(struct output *, const char *, va_list) __printflike(2, 0); 76int xwrite(int, const char *, int); 77 |
78#define outc(c, file) (--(file)->nleft < 0? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c))) | 78#define outc(c, file) ((file)->nextc == (file)->bufend ? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c))) |
79#define out1c(c) outc(c, out1); 80#define out2c(c) outcslow(c, out2); 81 82#define OUTPUT_INCL 83#endif | 79#define out1c(c) outc(c, out1); 80#define out2c(c) outcslow(c, out2); 81 82#define OUTPUT_INCL 83#endif |