don't call setbuf, use optimal size.
[unix-history] / usr / src / old / lib2648 / outchar.c
CommitLineData
f38ded87
RC
1/* outchar.c 4.1 83/03/09 */
2
3#include "2648.h"
4
5outchar(c)
6char c;
7{
8 extern int QUIET;
9#ifdef TRACE
10 if (trace)
11 fprintf(trace, "%s", rdchar(c));
12#endif
13 if (QUIET)
14 return;
15 _outcount++;
16 putchar(c);
17
18 /* Do 2648 ^E/^F handshake */
19 if (_outcount > TBLKSIZ && _on2648) {
20#ifdef TRACE
21 if (trace)
22 fprintf(trace, "ENQ .. ");
23#endif
24 putchar(ENQ);
25 fflush(stdout);
26 c = getchar();
27 while (c != ACK) {
28 if (_pb_front == NULL) {
29 _pb_front = _pushback;
30 _pb_back = _pb_front - 1;
31 }
32 *++_pb_back = c;
33#ifdef TRACE
34 if (trace)
35 fprintf(trace, "push back %s, front=%d, back=%d, ", rdchar(c), _pb_front-_pushback, _pb_front-_pushback);
36#endif
37 c = getchar();
38 }
39#ifdef TRACE
40 if (trace)
41 fprintf(trace, "ACK\n");
42#endif
43 _outcount = 0;
44 }
45}