static char *sccsid
= "@(#)wwinit.c 3.1 83/08/11";
static char *kp
= wwkeys
;
wwdtablesize
= getdtablesize();
if (wwgettty(0, &wwoldtty
) < 0)
wwwintty
.ww_sgttyb
.sg_flags
&= ~XTABS
;
wwnewtty
.ww_sgttyb
.sg_flags
= wwoldtty
.ww_sgttyb
.sg_flags
;
wwnewtty
.ww_sgttyb
.sg_ispeed
= wwoldtty
.ww_sgttyb
.sg_ispeed
;
wwnewtty
.ww_sgttyb
.sg_ospeed
= wwoldtty
.ww_sgttyb
.sg_ospeed
;
wwnewtty
.ww_lmode
= wwoldtty
.ww_lmode
;
wwnewtty
.ww_pgrp
= wwoldtty
.ww_pgrp
;
wwnewtty
.ww_ldisc
= wwoldtty
.ww_ldisc
;
wwnewtty
.ww_sgttyb
.sg_flags
|= CBREAK
;
wwnewtty
.ww_sgttyb
.sg_flags
&= ~(ECHO
|CRMOD
);
wwnewtty
.ww_lmode
|= LLITOUT
;
if (wwsettty(0, &wwnewtty
) < 0)
if ((wwterm
= getenv("TERM")) == 0)
if (tgetent(wwtermcap
, wwterm
) != 1)
wwbaud
= wwbaudmap
[wwoldtty
.ww_sgttyb
.sg_ospeed
];
if ((wwsmap
= wwalloc(wwnrow
, wwncol
, sizeof (char))) == 0)
for (i
= 0; i
< wwnrow
; i
++)
for (j
= 0; j
< wwncol
; j
++)
wwsmap
[i
][j
] = WWX_NOBODY
;
wwos
= (union ww_char
**)
wwalloc(wwnrow
, wwncol
, sizeof (union ww_char
));
for (i
= 0; i
< wwnrow
; i
++)
for (j
= 0; j
< wwncol
; j
++)
wwns
= (union ww_char
**)
wwalloc(wwnrow
, wwncol
, sizeof (union ww_char
));
for (i
= 0; i
< wwnrow
; i
++)
for (j
= 0; j
< wwncol
; j
++)
wwindex
[WWX_NOBODY
] = &wwnobody
;
if ((kn
= tgetnum("kn")) >= 0) {
(void) sprintf(kp
, "kn#%d:", kn
);
for (i
= 1; i
<= kn
; i
++) {
(void) sprintf(cap
, "k%d", i
);
(void) wwsettty(0, &wwoldtty
);
if ((str
= tgetstr(cap
, &tp
)) != 0) {
for (p
= unctrl(*str
++); *kp
++ = *p
++;)