home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 419b.lha / TERMLIB / tinit.c < prev    next >
C/C++ Source or Header  |  1990-10-05  |  910b  |  54 lines

  1. /* TERMLIB: Terminal independant database.
  2.  *
  3.  * Module: tinit
  4.  *
  5.  * Purpose: simplified terminal initialisation.
  6.  *
  7.  * Calling conventions: name is name of terminal.
  8.  *
  9.  * Returned values: none.
  10.  *
  11.  * Notes
  12.  *        tinit calls tgetent, then sets up the global
  13.  *    variables PC, UP, BC, ospeed appropriately.
  14.  *
  15.  */
  16. #include "termlib.h"
  17. #include <stdio.h>
  18. #if !AMIGA
  19. #include <sgtty.h>
  20. #endif
  21.  
  22. /* tinit.c (libtermlib.a)
  23.  *
  24.  */
  25.  
  26. char tbuf[1024];                                /* Buffer for termcap entry */
  27. char junkbuf[1024];                                  /* Big buffer for junk */
  28. char *junkptr;
  29.  
  30. tinit(name)
  31. char *name;
  32. {
  33. #if !AMIGA
  34.     struct sgttyb sgbuf;
  35. #endif
  36.     char *ps;
  37.  
  38.     junkptr = junkbuf;
  39.  
  40.     tgetent(tbuf, name);
  41.  
  42.     ps = tgetstr("pc", &junkptr);
  43.     if(ps) PC = *ps;
  44.     UP = tgetstr("up", &junkptr);
  45.     BC = tgetstr("bc", &junkptr);
  46.  
  47. #if AMIGA
  48.     ospeed=0;
  49. #else
  50.     gtty(1, &sgbuf);
  51.     ospeed=sgbuf.sg_ospeed;
  52. #endif
  53. }
  54.