# 2.11BSD#431 - /usr/src/ucb/window/ttinit.c

##### Functions

    ttinit            X

##### Variables

    tt_tab            X

       1: #if !defined(lint) && defined(DOSCCS)
       2: static char sccsid[] = "@(#)ttinit.c	3.14.1 1996/3/22";
       3: #endif
       4:
       5: /*
       6:  * Copyright (c) 1983 Regents of the University of California,
       7:  * All rights reserved.  Redistribution permitted subject to
       8:  * the terms of the Berkeley Software License Agreement.
       9:  */
      10:
      11: #include "ww.h"
      12: #include "tt.h"
      13:
      14: int tt_h19();
      15: int tt_h29();
      16: int tt_f100();
      17: int tt_tvi925();
      18: int tt_generic();
      19: struct tt_tab tt_tab[] = {
      20:     { "h19",    3, tt_h19 },
      21:     { "h29",    3, tt_h29 },
      22:     { "f100",   4, tt_f100 },
      23:     { "tvi925", 6, tt_tvi925 },
      24:     { "generic",    0, tt_generic },
      25:     0
      26: };
      27:
      28: ttinit()
      29: {
      30:     register struct tt_tab *tp;
      31:     register char *p, *q;
      32:     register char *t;
      33:     struct winsize winsize;
      34:
      35:     tt_strp = tt_strings;
      36:
      37:     /*
      38: 	 * Set output buffer size to about 1 second of output time.
      39: 	 */
      40:     tt_obp = tt_ob;
      41:     tt_obe = tt_ob + MIN(wwbaud/10, TTOBSIZ);
      42:
      43:     /*
      44: 	 * Use the standard name of the terminal (i.e. the second
      45: 	 * name in termcap).
      46: 	 */
      47:     for (p = wwtermcap; *p && *p != '|' && *p != ':'; p++)
      48:         ;
      49:     if (*p == '|')
      50:         p++;
      51:     for (q = p; *q && *q != '|' && *q != ':'; q++)
      52:         ;
      53:     if (q != p && (t = (char *)malloc((unsigned) (q - p + 1))) != 0) {
      54:         wwterm = t;
      55:         while (p < q)
      56:             *t++ = *p++;
      57:         *t = 0;
      58:     }
      59:     for (tp = tt_tab; tp->tt_name != 0; tp++)
      60:         if (strncmp(tp->tt_name, wwterm, tp->tt_len) == 0)
      61:             break;
      62:     if (tp->tt_name == 0) {
      63:         wwerrno = WWE_BADTERM;
      64:         return -1;
      65:     }
      66:     if ((*tp->tt_func)() < 0) {
      67:         wwerrno = WWE_CANTDO;
      68:         return -1;
      69:     }
      70:     if (ioctl(0, TIOCGWINSZ, (char *)&winsize) >= 0 &&
      71:         winsize.ws_row != 0 && winsize.ws_col != 0) {
      72:         tt.tt_nrow = winsize.ws_row;
      73:         tt.tt_ncol = winsize.ws_col;
      74:     }
      75:     return 0;
      76: }

#### Defined functions

ttinit defined in line 28; used 1 times

- in /usr/src/ucb/window/wwinit.c line 71

#### Defined variables

sccsid defined in line 2; never used
tt_tab defined in line 19; used 1 times

- in line 59

Last modified: 1996-03-23 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 547 |