1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #if !defined(lint) && !defined(NOSCCS)
   8: static char sccsid[] = "@(#)tc2.c	5.1 (Berkeley) 6/5/85";
   9: #endif not lint
  10: 
  11: /*
  12:  * tc2 [term]
  13:  * Dummy program to test out termlib.
  14:  * Commands are "tcc\n" where t is type (s for string, f for flag,
  15:  * or n for number) and cc is the name of the capability.
  16:  */
  17: #include <stdio.h>
  18: char buf[1024];
  19: char *getenv(), *tgetstr();
  20: 
  21: main(argc, argv) char **argv; {
  22:     char *p, *q;
  23:     int rc;
  24:     char b[3], c;
  25:     char area[200];
  26: 
  27:     if (argc < 2)
  28:         p = getenv("TERM");
  29:     else
  30:         p = argv[1];
  31:     rc = tgetent(buf,p);
  32:     for (;;) {
  33:         c = getchar();
  34:         if (c < 0)
  35:             exit(0);
  36:         b[0] = getchar();
  37:         if (b[0] < ' ')
  38:             exit(0);
  39:         b[1] = getchar();
  40:         b[2] = 0;
  41:         getchar();
  42:         switch(c) {
  43:             case 'f':
  44:                 printf("%s: %d\n",b,tgetflag(b));
  45:                 break;
  46:             case 'n':
  47:                 printf("%s: %d\n",b,tgetnum(b));
  48:                 break;
  49:             case 's':
  50:                 q = area;
  51:                 printf("%s: %s\n",b,tgetstr(b,&q));
  52:                 break;
  53:             default:
  54:                 exit(0);
  55:         }
  56:     }
  57: }

Defined functions

main defined in line 21; never used

Defined variables

buf defined in line 18; used 1 times
  • in line 31
sccsid defined in line 8; never used
Last modified: 1989-05-08
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1891
Valid CSS Valid XHTML 1.0 Strict