delete spurious debug abort()
[unix-history] / usr / src / lib / libcurses / setterm.c
index a332315..1dd8bd2 100644 (file)
@@ -1,13 +1,10 @@
 /*
  * Terminal initialization routines.
  *
 /*
  * Terminal initialization routines.
  *
- * %G% (Berkeley) @(#)setterm.c        1.6
+ * %G% (Berkeley) @(#)setterm.c        1.12
  */
 
  */
 
-# undef        DEBUG
-
 # include      "curses.ext"
 # include      "curses.ext"
-# include      "cr_ex.h"
 
 static bool    *sflags[]       = {
                        &AM, &BS, &EO, &HZ, &IN, &MI, &MS, &NC, &OS, &UL, &XN
 
 static bool    *sflags[]       = {
                        &AM, &BS, &EO, &HZ, &IN, &MI, &MS, &NC, &OS, &UL, &XN
@@ -15,14 +12,15 @@ static bool *sflags[]       = {
 
 static char    *xPC,
                **sstrs[]       = {
 
 static char    *xPC,
                **sstrs[]       = {
-                       &AL, &BC,  &BT, &CD, &CE, &CL, &CM, &DC, &DL,
-                       &DM, &DO,  &ED, &EI, &HO, &IC, &IM, &IP, &LL,
-                       &MA, &ND, &xPC, &SE, &SF, &SO, &SR, &TA, &TE,
-                       &TI, &UC,  &UE, &UP, &US, &VB, &VS, &VE
+                       &AL, &BC, &BT, &CD,  &CE, &CL, &CM, &CR, &DC,
+                       &DL, &DM, &DO, &ED,  &EI, &HO, &IC, &IM, &IP,
+                       &LL, &MA, &ND, &NL, &xPC, &SE, &SF, &SO, &SR,
+                       &TA, &TE, &TI, &UC,  &UE, &UP, &US, &VB, &VS,
+                       &VE
                },
                *tgoto();
 
                },
                *tgoto();
 
-static char    tspace[128],            /* Space for capability strings */
+static char    tspace[256],            /* Space for capability strings */
                *aoftspace;             /* Address of tspace for relocation */
 
 static int     destcol, destline;
                *aoftspace;             /* Address of tspace for relocation */
 
 static int     destcol, destline;
@@ -59,8 +57,8 @@ gettmode() {
 setterm(type)
 reg char       *type; {
 
 setterm(type)
 reg char       *type; {
 
-       reg int unknown;
-       char    genbuf[1024];
+       reg int         unknown;
+       static char     genbuf[1024];
 
 # ifdef DEBUG
        fprintf(outf, "SETTERM(\"%s\")\n", type);
 
 # ifdef DEBUG
        fprintf(outf, "SETTERM(\"%s\")\n", type);
@@ -106,12 +104,13 @@ reg char  *type; {
        return OK;
 }
 /*
        return OK;
 }
 /*
- *     This routine gets all the terminal falgs from the termcap database
+ *     This routine gets all the terminal flags from the termcap database
  */
 zap() {
 
        reg bool        **fp;
        reg char        *namp, ***sp;
  */
 zap() {
 
        reg bool        **fp;
        reg char        *namp, ***sp;
+       reg int         SG, UG;
        extern char     *tgetstr();
 
        /*
        extern char     *tgetstr();
 
        /*
@@ -133,7 +132,7 @@ zap() {
        /*
         * get string values
         */
        /*
         * get string values
         */
-       namp = "albcbtcdceclcmdcdldmdoedeihoicimipllmandpcsesfsosrtatetiucueupusvbvsve";
+       namp = "albcbtcdceclcmcrdcdldmdoedeihoicimipllmandnlpcsesfsosrtatetiucueupusvbvsve";
 # ifdef FULLDEBUG
        fprintf(outf, "ZAP: namp = \"%s\"\n", namp);
 # endif
 # ifdef FULLDEBUG
        fprintf(outf, "ZAP: namp = \"%s\"\n", namp);
 # endif
@@ -145,7 +144,9 @@ zap() {
 # endif
                namp += 2;
        } while (*namp);
 # endif
                namp += 2;
        } while (*namp);
-       if (!SO && US) {
+       SG = tgetnum("sg");
+       UG = tgetnum("ug");
+       if ((SG > 0 || !SO) && (UG <= 0 && US)) {
                SO = US;
                SE = UE;
        }
                SO = US;
                SE = UE;
        }
@@ -158,7 +159,7 @@ char *
 getcap(name)
 char *name;
 {
 getcap(name)
 char *name;
 {
-       char *tgetent();
+       char *tgetstr();
 
 
-       return tgetent(name, &aoftspace);
+       return tgetstr(name, &aoftspace);
 }
 }