use the terminal's standard name.
authorEdward Wang <edward@ucbvax.Berkeley.EDU>
Tue, 16 Aug 1983 08:41:57 +0000 (00:41 -0800)
committerEdward Wang <edward@ucbvax.Berkeley.EDU>
Tue, 16 Aug 1983 08:41:57 +0000 (00:41 -0800)
SCCS-vsn: usr.bin/window/ttinit.c 3.3

usr/src/usr.bin/window/ttinit.c

index 61a645a..a279a67 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)ttinit.c    3.2 83/08/11";
+static char *sccsid = "@(#)ttinit.c    3.3 83/08/15";
 #endif
 
 #include "ww.h"
 #endif
 
 #include "ww.h"
@@ -7,7 +7,25 @@ static char *sccsid = "@(#)ttinit.c    3.2 83/08/11";
 ttinit()
 {
        register struct tt_tab *tp;
 ttinit()
 {
        register struct tt_tab *tp;
+       register char *p, *q;
+       register char *t;
 
 
+       /*
+        * Use the standard name of the terminal (i.e. the second
+        * name in termcap).
+        */
+       for (p = wwtermcap; *p && *p != '|' && *p != ':'; p++)
+               ;
+       if (*p == '|')
+               p++;
+       for (q = p; *q && *q != '|' && *q != ':'; q++)
+               ;
+       if (q != p && (t = malloc(q - p + 1)) != 0) {
+               wwterm = t;
+               while (p < q)
+                       *t++ = *p++;
+               *t = 0;
+       }
        for (tp = tt_tab; tp->tt_name != 0; tp++)
                if (strncmp(tp->tt_name, wwterm, tp->tt_len) == 0)
                        break;
        for (tp = tt_tab; tp->tt_name != 0; tp++)
                if (strncmp(tp->tt_name, wwterm, tp->tt_len) == 0)
                        break;