Deleted Added
full compact
output.c (213760) output.c (213811)
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

--- 22 unchanged lines hidden (view full) ---

31 */
32
33#ifndef lint
34#if 0
35static char sccsid[] = "@(#)output.c 8.2 (Berkeley) 5/4/95";
36#endif
37#endif /* not lint */
38#include <sys/cdefs.h>
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

--- 22 unchanged lines hidden (view full) ---

31 */
32
33#ifndef lint
34#if 0
35static char sccsid[] = "@(#)output.c 8.2 (Berkeley) 5/4/95";
36#endif
37#endif /* not lint */
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/bin/sh/output.c 213760 2010-10-13 04:01:01Z obrien $");
39__FBSDID("$FreeBSD: head/bin/sh/output.c 213811 2010-10-13 22:18:03Z obrien $");
40
41/*
42 * Shell output routines. We use our own output routines because:
43 * When a builtin command is interrupted we have to discard
44 * any pending output.
45 * When a builtin command appears in back quotes, we want to
46 * save the output of the command in a region obtained
47 * via malloc, rather than doing a fork and reading the

--- 15 unchanged lines hidden (view full) ---

63#include "var.h"
64
65
66#define OUTBUFSIZ BUFSIZ
67#define BLOCK_OUT -2 /* output to a fixed block of memory */
68#define MEM_OUT -3 /* output to dynamically allocated memory */
69#define OUTPUT_ERR 01 /* error occurred on output */
70
40
41/*
42 * Shell output routines. We use our own output routines because:
43 * When a builtin command is interrupted we have to discard
44 * any pending output.
45 * When a builtin command appears in back quotes, we want to
46 * save the output of the command in a region obtained
47 * via malloc, rather than doing a fork and reading the

--- 15 unchanged lines hidden (view full) ---

63#include "var.h"
64
65
66#define OUTBUFSIZ BUFSIZ
67#define BLOCK_OUT -2 /* output to a fixed block of memory */
68#define MEM_OUT -3 /* output to dynamically allocated memory */
69#define OUTPUT_ERR 01 /* error occurred on output */
70
71STATIC int doformat_wr(void *, const char *, int);
71static int doformat_wr(void *, const char *, int);
72
73struct output output = {NULL, 0, NULL, OUTBUFSIZ, 1, 0};
74struct output errout = {NULL, 0, NULL, 256, 2, 0};
75struct output memout = {NULL, 0, NULL, 0, MEM_OUT, 0};
76struct output *out1 = &output;
77struct output *out2 = &errout;
78
79

--- 196 unchanged lines hidden (view full) ---

276 va_start(ap, fmt);
277 doformat(&strout, fmt, ap);
278 va_end(ap);
279 outc('\0', &strout);
280 if (strout.flags & OUTPUT_ERR)
281 outbuf[length - 1] = '\0';
282}
283
72
73struct output output = {NULL, 0, NULL, OUTBUFSIZ, 1, 0};
74struct output errout = {NULL, 0, NULL, 256, 2, 0};
75struct output memout = {NULL, 0, NULL, 0, MEM_OUT, 0};
76struct output *out1 = &output;
77struct output *out2 = &errout;
78
79

--- 196 unchanged lines hidden (view full) ---

276 va_start(ap, fmt);
277 doformat(&strout, fmt, ap);
278 va_end(ap);
279 outc('\0', &strout);
280 if (strout.flags & OUTPUT_ERR)
281 outbuf[length - 1] = '\0';
282}
283
284STATIC int
284static int
285doformat_wr(void *cookie, const char *buf, int len)
286{
287 struct output *o;
288 int origlen;
289 unsigned char c;
290
291 o = (struct output *)cookie;
292 origlen = len;

--- 47 unchanged lines hidden ---
285doformat_wr(void *cookie, const char *buf, int len)
286{
287 struct output *o;
288 int origlen;
289 unsigned char c;
290
291 o = (struct output *)cookie;
292 origlen = len;

--- 47 unchanged lines hidden ---