xref: /original-bsd/lib/libterm/TEST/tc1.c (revision 0fc6f013)
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 #ifndef lint
8 static char sccsid[] = "@(#)tc1.c	5.1 (Berkeley) 06/05/85";
9 #endif not lint
10 
11 /*
12  * tc1 [term]
13  * dummy program to test termlib.
14  * gets entry, counts it, and prints it.
15  */
16 #include <stdio.h>
17 char buf[1024];
18 char *getenv();
19 
20 main(argc, argv) char **argv; {
21 	char *p;
22 	int rc;
23 
24 	if (argc < 2)
25 		p = getenv("TERM");
26 	else
27 		p = argv[1];
28 	rc = tgetent(buf,p);
29 	printf("tgetent returns %d, len=%d, text=\n'%s'\n",rc,strlen(buf),buf);
30 }
31