xref: /original-bsd/lib/libterm/TEST/tc1.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1983, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char copyright[] =
10 "@(#) Copyright (c) 1983, 1993\n\
11 	The Regents of the University of California.  All rights reserved.\n";
12 #endif /* not lint */
13 
14 #ifndef lint
15 static char sccsid[] = "@(#)tc1.c	8.1 (Berkeley) 06/04/93";
16 #endif /* not lint */
17 
18 /*
19  * tc1 [term]
20  * dummy program to test termlib.
21  * gets entry, counts it, and prints it.
22  */
23 #include <stdio.h>
24 char buf[1024];
25 char *getenv();
26 
27 main(argc, argv) char **argv; {
28 	char *p;
29 	int rc;
30 
31 	if (argc < 2)
32 		p = getenv("TERM");
33 	else
34 		p = argv[1];
35 	rc = tgetent(buf,p);
36 	printf("tgetent returns %d, len=%d, text=\n'%s'\n",rc,strlen(buf),buf);
37 }
38