xref: /original-bsd/old/lib2648/printg.c (revision 3b6250d9)
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[] = "@(#)printg.c	5.1 (Berkeley) 04/26/85";
9 #endif not lint
10 
11 #include "2648.h"
12 
13 printg()
14 {
15 	int oldvid = _video;
16 	int c, c2;
17 
18 	if (oldvid==INVERSE)
19 		togvid();
20 	sync();
21 	escseq(NONE);
22 	outstr("\33&p4d5u0C");
23 	outchar('\21');	/* test handshaking fix */
24 
25 	/*
26 	 * The terminal sometimes sends back S<cr> or F<cr>.
27 	 * Ignore them.
28 	 */
29 	fflush(stdout);
30 	c = getchar();
31 	if (c=='F' || c=='S') {
32 		c2 = getchar();
33 		if (c2 != '\r' && c2 != '\n')
34 			ungetc(c2, stdin);
35 	} else {
36 		ungetc(c, stdin);
37 	}
38 
39 	if (oldvid==INVERSE)
40 		togvid();
41 }
42