1*22070Sdist /* 2*22070Sdist * Copyright (c) 1980 Regents of the University of California. 3*22070Sdist * All rights reserved. The Berkeley software License Agreement 4*22070Sdist * specifies the terms and conditions for redistribution. 5*22070Sdist */ 6*22070Sdist 713298Ssam #ifndef lint 8*22070Sdist static char sccsid[] = "@(#)tc2.c 5.1 (Berkeley) 06/05/85"; 9*22070Sdist #endif not lint 1013298Ssam 1113298Ssam /* 1213298Ssam * tc2 [term] 1313298Ssam * Dummy program to test out termlib. 1413298Ssam * Commands are "tcc\n" where t is type (s for string, f for flag, 1513298Ssam * or n for number) and cc is the name of the capability. 1613298Ssam */ 1713298Ssam #include <stdio.h> 1813298Ssam char buf[1024]; 1913298Ssam char *getenv(), *tgetstr(); 2013298Ssam 2113298Ssam main(argc, argv) char **argv; { 2213298Ssam char *p, *q; 2313298Ssam int rc; 2413298Ssam char b[3], c; 2513298Ssam char area[200]; 2613298Ssam 2713298Ssam if (argc < 2) 2813298Ssam p = getenv("TERM"); 2913298Ssam else 3013298Ssam p = argv[1]; 3113298Ssam rc = tgetent(buf,p); 3213298Ssam for (;;) { 3313298Ssam c = getchar(); 3413298Ssam if (c < 0) 3513298Ssam exit(0); 3613298Ssam b[0] = getchar(); 3713298Ssam if (b[0] < ' ') 3813298Ssam exit(0); 3913298Ssam b[1] = getchar(); 4013298Ssam b[2] = 0; 4113298Ssam getchar(); 4213298Ssam switch(c) { 4313298Ssam case 'f': 4413298Ssam printf("%s: %d\n",b,tgetflag(b)); 4513298Ssam break; 4613298Ssam case 'n': 4713298Ssam printf("%s: %d\n",b,tgetnum(b)); 4813298Ssam break; 4913298Ssam case 's': 5013298Ssam q = area; 5113298Ssam printf("%s: %s\n",b,tgetstr(b,&q)); 5213298Ssam break; 5313298Ssam default: 5413298Ssam exit(0); 5513298Ssam } 5613298Ssam } 5713298Ssam } 58