|
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 - downloadIndex: ┃ T t ┃
Length: 3672 (0xe58) Types: TextFile Names: »term.c«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/jove/term.c«
/************************************************************************ * This program is Copyright (C) 1986 by Jonathan Payne. JOVE is * * provided to you without charge, and with no warranty. You may give * * away copies of JOVE, including sources, provided that this notice is * * included in all the files. * ************************************************************************/ #include "jove.h" #include <errno.h> #ifdef SYSV # include <termio.h> #else # include <sgtty.h> #endif SYSV #ifdef IPROCS # include <signal.h> #endif /* Termcap definitions */ char *UP, *CS, *SO, *SE, *CM, *CL, *CE, *HO, *AL, *DL, *VS, *VE, *KS, *KE, *TI, *TE, *IC, *DC, *IM, *EI, *LL, *BC, *M_IC, /* Insert char with arg */ *M_DC, /* Delete char with arg */ *M_AL, /* Insert line with arg */ *M_DL, /* Delete line with arg */ *SF, /* Scroll forward */ *SR, *SP, /* Send Cursor Position */ #ifdef LSRHS *RS, /* Reverse video start */ *RE, /* Reverse end */ #endif *VB, *IP, /* insert pad after character inserted */ *lPC; int LI, ILI, /* Internal lines, i.e., 23 of LI is 24. */ CO, UL, MI, SG, /* number of magic cookies left by SO and SE */ XS, /* whether standout is braindamaged */ TABS, UPlen, HOlen, LLlen; #ifdef SYSV /* release 2, at least */ char PC ; #else extern char PC; #endif SYSV static char tspace[256]; /* The ordering of ts and meas must agree !! */ #ifdef LSRHS static char *ts="vsvealdlspcssosecmclcehoupbcicimdceillsfsrvbksketiteALDLICDCrsrepcip"; static char **meas[] = { &VS, &VE, &AL, &DL, &SP, &CS, &SO, &SE, &CM, &CL, &CE, &HO, &UP, &BC, &IC, &IM, &DC, &EI, &LL, &SF, &SR, &VB, &KS, &KE, &TI, &TE, &M_AL, &M_DL, &M_IC, &M_DC, &RS, &RE, &lPC, &IP, 0 }; #else static char *ts="vsvealdlspcssosecmclcehoupbcicimdceillsfsrvbksketiteALDLICDCpcip"; static char **meas[] = { &VS, &VE, &AL, &DL, &SP, &CS, &SO, &SE, &CM, &CL, &CE, &HO, &UP, &BC, &IC, &IM, &DC, &EI, &LL, &SF, &SR, &VB, &KS, &KE, &TI, &TE, &M_AL, &M_DL, &M_IC, &M_DC, &lPC, &IP, 0 }; #endif static gets(buf) char *buf; { buf[read(0, buf, 12) - 1] = 0; } /* VARARGS1 */ static TermError(fmt, a) char *fmt; { printf(fmt, a); _exit(1); } getTERM() { char *getenv(), *tgetstr() ; char termbuf[13], *termname = 0, *termp = tspace, tbuff[2048]; /* Good grief! */ int i; termname = getenv("TERM"); if (termname == 0) { putstr("Enter terminal name: "); gets(termbuf); if (termbuf[0] == 0) TermError(NullStr); termname = termbuf; } if (tgetent(tbuff, termname) < 1) TermError("[\"%s\" unknown terminal type?]", termname); if ((CO = tgetnum("co")) == -1) TermError("columns?"); if ((LI = tgetnum("li")) == -1) TermError("lines?"); if ((SG = tgetnum("sg")) == -1) SG = 0; /* Used for mode line only */ if ((XS = tgetflag("xs")) == -1) XS = 0; /* Used for mode line only */ for (i = 0; meas[i]; i++) { *(meas[i]) = (char *) tgetstr(ts, &termp); ts += 2; } if (lPC) PC = *lPC; if (XS) SO = SE = 0; if (CS && !SR) CS = SR = SF = 0; if (CS && !SF) SF = "\n"; if (IM && (*IM == 0)) IM = 0; else MI = tgetflag("mi"); UL = tgetflag("ul"); #ifdef LSRHS /* We, at the high school, are the only ones who do SO right in termcap, but unfortunately the right SO doesn't look as good with modelines. */ if (RS) SO = RS; if (RE) SE = RE; /* I only ever use SO for the modeline anyway. */ /* SO is really BOLDFACE! Why is LS always right and the rest of the world wrong? */ #endif #ifdef ID_CHAR disp_opt_init(); #endif if (CanScroll = ((AL && DL) || CS)) IDline_setup(termname); }