-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_initcon.c
49 lines (39 loc) · 1.08 KB
/
_initcon.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* _ i n i t c o n
*
* Routine used when the functions defined in TERMIOS_H are
* are in use. It initialises the 'termios' part of the
* Console driver in a manner suitable for use by the other
* routines defined in TERMIOS.
*
* It is called from the end of the program initialisation code.
*
* Amendment History
* ~~~~~~~~~~~~~~~~~
* 15 Sep 92 DJW first version.
*/
#define __LIBRARY__
#include <qdos.h>
#include <fcntl.h>
#include <stdlib.h>
#include <termios.h>
extern chanid_t _conchan;
static char lines[13] = "LINES=";
static char cols[15] = "COLUMNS=";
void _initcon()
{
(_Chkufb(1))->ufbflg &= ~UFB_ND; /* Clear No-Delay flag for stdout */
/*
* If a console is in use, set the LINES and COLUMNS environment
* variables to the correct size.
*/
if (_conchan ) {
struct QLRECT rect[1];
(void) sd_chenq (_conchan, 0, rect);
(void) itoa (rect->q_height, &lines[6]);
(void) putenv (lines);
(void) itoa (rect->q_width, &cols[8]);
(void) putenv (cols);
}
return;
}