wbuf.c (333fc21e3cd79bca0c94d7722c5a56cb5ad078d1) wbuf.c (e74101e4eff767325553039def89de70b70f36d3)
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

--- 55 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
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

--- 55 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 ---