Commit | Line | Data |
---|---|---|
11dcbb27 | 1 | #ifndef lint |
94c16993 | 2 | static char *sccsid = "@(#)ttinit.c 3.5 83/08/15"; |
11dcbb27 EW |
3 | #endif |
4 | ||
5 | #include "ww.h" | |
e908bfac | 6 | #include "tt.h" |
11dcbb27 EW |
7 | |
8 | ttinit() | |
9 | { | |
10 | register struct tt_tab *tp; | |
078fe826 EW |
11 | register char *p, *q; |
12 | register char *t; | |
11dcbb27 | 13 | |
078fe826 EW |
14 | /* |
15 | * Use the standard name of the terminal (i.e. the second | |
16 | * name in termcap). | |
17 | */ | |
18 | for (p = wwtermcap; *p && *p != '|' && *p != ':'; p++) | |
19 | ; | |
20 | if (*p == '|') | |
21 | p++; | |
22 | for (q = p; *q && *q != '|' && *q != ':'; q++) | |
23 | ; | |
94c16993 | 24 | if (q != p && (t = malloc((unsigned) (q - p + 1))) != 0) { |
078fe826 EW |
25 | wwterm = t; |
26 | while (p < q) | |
27 | *t++ = *p++; | |
28 | *t = 0; | |
29 | } | |
11dcbb27 EW |
30 | for (tp = tt_tab; tp->tt_name != 0; tp++) |
31 | if (strncmp(tp->tt_name, wwterm, tp->tt_len) == 0) | |
32 | break; | |
33 | if (tp->tt_name == 0) | |
34 | return -1; | |
e908bfac | 35 | return (*tp->tt_func)(); |
11dcbb27 | 36 | } |