xref: /csrg-svn/old/lib2648/printg.c (revision 18779)
1*18779Sdist /*
2*18779Sdist  * Copyright (c) 1980 Regents of the University of California.
3*18779Sdist  * All rights reserved.  The Berkeley software License Agreement
4*18779Sdist  * specifies the terms and conditions for redistribution.
5*18779Sdist  */
611487Sralph 
7*18779Sdist #ifndef lint
8*18779Sdist static char sccsid[] = "@(#)printg.c	5.1 (Berkeley) 04/26/85";
9*18779Sdist #endif not lint
10*18779Sdist 
1111487Sralph #include "2648.h"
1211487Sralph 
printg()1311487Sralph printg()
1411487Sralph {
1511487Sralph 	int oldvid = _video;
1611487Sralph 	int c, c2;
1711487Sralph 
1811487Sralph 	if (oldvid==INVERSE)
1911487Sralph 		togvid();
2011487Sralph 	sync();
2111487Sralph 	escseq(NONE);
2211487Sralph 	outstr("\33&p4d5u0C");
2311487Sralph 	outchar('\21');	/* test handshaking fix */
2411487Sralph 
2511487Sralph 	/*
2611487Sralph 	 * The terminal sometimes sends back S<cr> or F<cr>.
2711487Sralph 	 * Ignore them.
2811487Sralph 	 */
2911487Sralph 	fflush(stdout);
3011487Sralph 	c = getchar();
3111487Sralph 	if (c=='F' || c=='S') {
3211487Sralph 		c2 = getchar();
3311487Sralph 		if (c2 != '\r' && c2 != '\n')
3411487Sralph 			ungetc(c2, stdin);
3511487Sralph 	} else {
3611487Sralph 		ungetc(c, stdin);
3711487Sralph 	}
3811487Sralph 
3911487Sralph 	if (oldvid==INVERSE)
4011487Sralph 		togvid();
4111487Sralph }
42