include signal.h
[unix-history] / usr / src / old / lib2648 / ttyinit.c
CommitLineData
97e3edfb
DF
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
8static char sccsid[] = "@(#)ttyinit.c 5.1 (Berkeley) %G%";
9#endif not lint
10
da0fa7dd
RC
11/*
12 * sgtty stuff
13 */
14
15#include <sgtty.h>
16
17struct sgttyb _ttyb;
18struct tchars _otch, _ntch;
19int _normf;
20
21/*
22 * Routines for dealing with the unix tty modes
23 */
24
25#include "2648.h"
26
27ttyinit()
28{
29 if (strcmp(getenv("TERM"), "hp2648") == 0)
30 _on2648 = 1;
31 ioctl(fileno(stdin), TIOCGETP, &_ttyb);
32 ioctl(fileno(stdin), TIOCGETC, &_otch);
33 _ntch = _otch;
34 _ntch.t_quitc = _ntch.t_startc = _ntch.t_stopc = -1;
35 _normf = _ttyb.sg_flags;
36 _ttyb.sg_flags |= CBREAK;
37 _ttyb.sg_flags &= ~(ECHO|CRMOD);
38 ioctl(fileno(stdin), TIOCSETN, &_ttyb);
39 ioctl(fileno(stdin), TIOCSETC, &_ntch);
40 gdefault();
41 zoomn(1);
42 zoomon();
43 kon();
44 rboff();
45 _cursoron = 1; /* to force it off */
46 _escmode = NONE;
47 curoff();
48 clearg();
49 gon();
50 aoff();
51}
52
53done()
54{
55 goff();
56 koff();
57 aon();
58 sync();
59 escseq(NONE);
60 lowleft();
61 printf("\n");
62 fflush(stdout);
63 _ttyb.sg_flags = _normf;
64 ioctl(fileno(stdin), TIOCSETN, &_ttyb);
65 ioctl(fileno(stdin), TIOCSETC, &_otch);
66}