Deleted Added
full compact
wbuf.c (92986) wbuf.c (101776)
1/*-
2 * Copyright (c) 1990, 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 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#if defined(LIBC_SCCS) && !defined(lint)
38static char sccsid[] = "@(#)wbuf.c 8.1 (Berkeley) 6/4/93";
39#endif /* LIBC_SCCS and not lint */
40#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1990, 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 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#if defined(LIBC_SCCS) && !defined(lint)
38static char sccsid[] = "@(#)wbuf.c 8.1 (Berkeley) 6/4/93";
39#endif /* LIBC_SCCS and not lint */
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/lib/libc/stdio/wbuf.c 92986 2002-03-22 21:53:29Z obrien $");
41__FBSDID("$FreeBSD: head/lib/libc/stdio/wbuf.c 101776 2002-08-13 09:30:41Z tjr $");
42
43#include <stdio.h>
44#include "local.h"
45
46/*
47 * Write the given character into the (probably full) buffer for
48 * the given file. Flush the buffer out if it is or becomes full,
49 * or if c=='\n' and the file is line buffered.

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

64 * If we did not do this, a sufficient number of putc()
65 * calls might wrap _w from negative to positive.
66 */
67 fp->_w = fp->_lbfsize;
68 if (cantwrite(fp))
69 return (EOF);
70 c = (unsigned char)c;
71
42
43#include <stdio.h>
44#include "local.h"
45
46/*
47 * Write the given character into the (probably full) buffer for
48 * the given file. Flush the buffer out if it is or becomes full,
49 * or if c=='\n' and the file is line buffered.

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

64 * If we did not do this, a sufficient number of putc()
65 * calls might wrap _w from negative to positive.
66 */
67 fp->_w = fp->_lbfsize;
68 if (cantwrite(fp))
69 return (EOF);
70 c = (unsigned char)c;
71
72 ORIENT(fp, -1);
73
72 /*
73 * If it is completely full, flush it out. Then, in any case,
74 * stuff c into the buffer. If this causes the buffer to fill
75 * completely, or if c is '\n' and the file is line buffered,
76 * flush it (perhaps a second time). The second flush will always
77 * happen on unbuffered streams, where _bf._size==1; fflush()
78 * guarantees that putc() will always call wbuf() by setting _w
79 * to 0, so we need not do anything else.

--- 14 unchanged lines hidden ---
74 /*
75 * If it is completely full, flush it out. Then, in any case,
76 * stuff c into the buffer. If this causes the buffer to fill
77 * completely, or if c is '\n' and the file is line buffered,
78 * flush it (perhaps a second time). The second flush will always
79 * happen on unbuffered streams, where _bf._size==1; fflush()
80 * guarantees that putc() will always call wbuf() by setting _w
81 * to 0, so we need not do anything else.

--- 14 unchanged lines hidden ---