home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume3 / lib_term / InitTerm.c < prev    next >
C/C++ Source or Header  |  1986-11-30  |  1KB  |  64 lines

  1. #include <stdio.h>
  2.  
  3. char bp[1024];
  4.  
  5. int InitTerm()
  6.  
  7. /*
  8.  ---------------------------------------------------------------------------
  9.  
  10.    Last revision - 
  11.      30 March 1984 - GWS
  12.  
  13.  
  14.    NAME
  15.      InitTerm - initialize data area for screen handling routines
  16.  
  17.    SYNOPSIS
  18.     InitTerm() 
  19.  
  20.    DESCRIPTION
  21.     Calls getenv to find out what terminal type to use and
  22.     then calls tgetent to initialize the string containing
  23.     the termcap.
  24.  
  25.    SEE ALSO
  26.     termcap(3x), page, gotoxy, underline, stand_out, clear_eol 
  27.  
  28.    DIAGNOSTICS
  29.     Returns 0 if successful
  30.            -1 if getenv fails
  31.            -2 if tgetent cannot open termcap file
  32.            -3 if tgetent cannot find entry for terminal
  33.  
  34.    BUGS
  35.     none known 
  36.  
  37.    AUTHOR
  38.      George W. Sherouse
  39.      30 March 1984
  40.  
  41.  ---------------------------------------------------------------------------
  42. */
  43.  
  44.  
  45. {
  46.     int tgetent(), ret;
  47.     char *getenv(), *cret;
  48.  
  49.     cret = getenv("TERM");
  50.     if (cret == NULL)
  51.     return(-1);
  52.  
  53.     ret = tgetent(bp, cret);
  54.     switch (ret)
  55.     {
  56.     case -1:
  57.     return(-2);
  58.     case 0:
  59.     return(-3);
  60.     case 1:
  61.     return(0);
  62.     }
  63. }
  64.