1 /*
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
7 #ifndef lint
8 static char sccsid[] = "@(#)outchar.c 5.1 (Berkeley) 04/26/85";
9 #endif not lint
10
11 #include "2648.h"
12
outchar(c)13 outchar(c)
14 char c;
15 {
16 extern int QUIET;
17 #ifdef TRACE
18 if (trace)
19 fprintf(trace, "%s", rdchar(c));
20 #endif
21 if (QUIET)
22 return;
23 _outcount++;
24 putchar(c);
25
26 /* Do 2648 ^E/^F handshake */
27 if (_outcount > TBLKSIZ && _on2648) {
28 #ifdef TRACE
29 if (trace)
30 fprintf(trace, "ENQ .. ");
31 #endif
32 putchar(ENQ);
33 fflush(stdout);
34 c = getchar();
35 while (c != ACK) {
36 if (_pb_front == NULL) {
37 _pb_front = _pushback;
38 _pb_back = _pb_front - 1;
39 }
40 *++_pb_back = c;
41 #ifdef TRACE
42 if (trace)
43 fprintf(trace, "push back %s, front=%d, back=%d, ", rdchar(c), _pb_front-_pushback, _pb_front-_pushback);
44 #endif
45 c = getchar();
46 }
47 #ifdef TRACE
48 if (trace)
49 fprintf(trace, "ACK\n");
50 #endif
51 _outcount = 0;
52 }
53 }
54