|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T t
Length: 1519 (0x5ef)
Types: TextFile
Names: »termcap.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Ogre/termcap.c«
#include <sgtty.h>
/*
Interface to termcap library.
*/
char PC;
char *BC, *UP;
char *eeolseq, *cmseq;
char *clearseq;
short ospeed;
int putchar();
tc_setup() {
static char bp[1024];
static char buffer[1024];
char *area = buffer;
char *getenv();
char *tgetstr();
char *name;
int retcode;
name = getenv("TERM");
retcode = tgetent(bp, name);
switch(retcode) {
case -1:
printf("can't open termcap file.\n");
exit(1);
break;
case 0:
printf("No termcap entry for %s.\n", name);
exit(1);
break;
}
eeolseq = tgetstr("ce", &area);
cmseq = tgetstr("cm", &area);
clearseq = tgetstr("cl", &area);
BC = tgetstr("bc", &area);
UP = tgetstr("up", &area);
}
eeol() {
tputs(eeolseq, 0, putchar);
}
clear_screen() {
tputs(clearseq, 0, putchar);
}
movecur(row, col)
int row, col;
{
tputs(tgoto(cmseq, col, row), 0, putchar);
}
struct sgttyb old_term;
struct sgttyb new_term;
/*
Set terminal to CBREAK and NOECHO.
*/
set_term() {
static int first = 1;
if(first) {
gtty(0, &old_term);
gtty(0, &new_term);
new_term.sg_flags &= ~(ECHO); /* | CRMOD); */
new_term.sg_flags |= CBREAK;
ospeed = new_term.sg_ospeed;
first = 0;
}
stty(0, &new_term);
}
/*
Reset the terminal to normal mode.
*/
reset_term() {
stty(0, &old_term);
}