1*47926Sbostic /*- 2*47926Sbostic * Copyright (c) 1983 The Regents of the University of California. 336499Sbostic * All rights reserved. 436499Sbostic * 5*47926Sbostic * %sccs.include.redist.c% 622070Sdist */ 722070Sdist 813298Ssam #ifndef lint 936499Sbostic char copyright[] = 10*47926Sbostic "@(#) Copyright (c) 1983 The Regents of the University of California.\n\ 1136499Sbostic All rights reserved.\n"; 1236499Sbostic #endif /* not lint */ 1313298Ssam 1436499Sbostic #ifndef lint 15*47926Sbostic static char sccsid[] = "@(#)tc2.c 5.3 (Berkeley) 04/12/91"; 1636499Sbostic #endif /* not lint */ 1736499Sbostic 1813298Ssam /* 1913298Ssam * tc2 [term] 2013298Ssam * Dummy program to test out termlib. 2113298Ssam * Commands are "tcc\n" where t is type (s for string, f for flag, 2213298Ssam * or n for number) and cc is the name of the capability. 2313298Ssam */ 2413298Ssam #include <stdio.h> 2513298Ssam char buf[1024]; 2613298Ssam char *getenv(), *tgetstr(); 2713298Ssam 2813298Ssam main(argc, argv) char **argv; { 2913298Ssam char *p, *q; 3013298Ssam int rc; 3113298Ssam char b[3], c; 3213298Ssam char area[200]; 3313298Ssam 3413298Ssam if (argc < 2) 3513298Ssam p = getenv("TERM"); 3613298Ssam else 3713298Ssam p = argv[1]; 3813298Ssam rc = tgetent(buf,p); 3913298Ssam for (;;) { 4013298Ssam c = getchar(); 4113298Ssam if (c < 0) 4213298Ssam exit(0); 4313298Ssam b[0] = getchar(); 4413298Ssam if (b[0] < ' ') 4513298Ssam exit(0); 4613298Ssam b[1] = getchar(); 4713298Ssam b[2] = 0; 4813298Ssam getchar(); 4913298Ssam switch(c) { 5013298Ssam case 'f': 5113298Ssam printf("%s: %d\n",b,tgetflag(b)); 5213298Ssam break; 5313298Ssam case 'n': 5413298Ssam printf("%s: %d\n",b,tgetnum(b)); 5513298Ssam break; 5613298Ssam case 's': 5713298Ssam q = area; 5813298Ssam printf("%s: %s\n",b,tgetstr(b,&q)); 5913298Ssam break; 6013298Ssam default: 6113298Ssam exit(0); 6213298Ssam } 6313298Ssam } 6413298Ssam } 65