1*18777Sdist /*
2*18777Sdist * Copyright (c) 1980 Regents of the University of California.
3*18777Sdist * All rights reserved. The Berkeley software License Agreement
4*18777Sdist * specifies the terms and conditions for redistribution.
5*18777Sdist */
611485Sralph
7*18777Sdist #ifndef lint
8*18777Sdist static char sccsid[] = "@(#)outchar.c 5.1 (Berkeley) 04/26/85";
9*18777Sdist #endif not lint
10*18777Sdist
1111485Sralph #include "2648.h"
1211485Sralph
outchar(c)1311485Sralph outchar(c)
1411485Sralph char c;
1511485Sralph {
1611485Sralph extern int QUIET;
1711485Sralph #ifdef TRACE
1811485Sralph if (trace)
1911485Sralph fprintf(trace, "%s", rdchar(c));
2011485Sralph #endif
2111485Sralph if (QUIET)
2211485Sralph return;
2311485Sralph _outcount++;
2411485Sralph putchar(c);
2511485Sralph
2611485Sralph /* Do 2648 ^E/^F handshake */
2711485Sralph if (_outcount > TBLKSIZ && _on2648) {
2811485Sralph #ifdef TRACE
2911485Sralph if (trace)
3011485Sralph fprintf(trace, "ENQ .. ");
3111485Sralph #endif
3211485Sralph putchar(ENQ);
3311485Sralph fflush(stdout);
3411485Sralph c = getchar();
3511485Sralph while (c != ACK) {
3611485Sralph if (_pb_front == NULL) {
3711485Sralph _pb_front = _pushback;
3811485Sralph _pb_back = _pb_front - 1;
3911485Sralph }
4011485Sralph *++_pb_back = c;
4111485Sralph #ifdef TRACE
4211485Sralph if (trace)
4311485Sralph fprintf(trace, "push back %s, front=%d, back=%d, ", rdchar(c), _pb_front-_pushback, _pb_front-_pushback);
4411485Sralph #endif
4511485Sralph c = getchar();
4611485Sralph }
4711485Sralph #ifdef TRACE
4811485Sralph if (trace)
4911485Sralph fprintf(trace, "ACK\n");
5011485Sralph #endif
5111485Sralph _outcount = 0;
5211485Sralph }
5311485Sralph }
54