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

  1. /* TERMLIB: Terminal independant database.
  2.  *
  3.  * Module: tgetnum
  4.  *
  5.  * Purpose: get numeric value such as 'li' or 'co' from termcap.
  6.  *
  7.  * Calling conventions: id = 2 character id.
  8.  *
  9.  * Returned values: -1 for failure, else numerical value.
  10.  */
  11. #include <stdio.h>
  12. #include <ctype.h>
  13. #include "termlib.h"
  14.  
  15. /* tgetnum.c (libtermlib.a)
  16.  *
  17.  */
  18.  
  19. tgetnum(id)
  20. char *id;
  21. {
  22.     char *ptr, buf[256];
  23.     ptr = buf;
  24.  
  25.     if(tgetstr(id, &ptr))
  26.         return atoi(buf);
  27.     else
  28.         return 0;
  29. }
  30.