xref: /csrg-svn/lib/libterm/TEST/tc1.c (revision 36499)
122069Sdist /*
2*36499Sbostic  * Copyright (c) 1980 The Regents of the University of California.
3*36499Sbostic  * All rights reserved.
4*36499Sbostic  *
5*36499Sbostic  * Redistribution and use in source and binary forms are permitted
6*36499Sbostic  * provided that the above copyright notice and this paragraph are
7*36499Sbostic  * duplicated in all such forms and that any documentation,
8*36499Sbostic  * advertising materials, and other materials related to such
9*36499Sbostic  * distribution and use acknowledge that the software was developed
10*36499Sbostic  * by the University of California, Berkeley.  The name of the
11*36499Sbostic  * University may not be used to endorse or promote products derived
12*36499Sbostic  * from this software without specific prior written permission.
13*36499Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14*36499Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15*36499Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1622069Sdist  */
1722069Sdist 
1813297Ssam #ifndef lint
19*36499Sbostic char copyright[] =
20*36499Sbostic "@(#) Copyright (c) 1980 The Regents of the University of California.\n\
21*36499Sbostic  All rights reserved.\n";
22*36499Sbostic #endif /* not lint */
2313297Ssam 
24*36499Sbostic #ifndef lint
25*36499Sbostic static char sccsid[] = "@(#)tc1.c	5.2 (Berkeley) 01/03/89";
26*36499Sbostic #endif /* not lint */
27*36499Sbostic 
2813297Ssam /*
2913297Ssam  * tc1 [term]
3013297Ssam  * dummy program to test termlib.
3113297Ssam  * gets entry, counts it, and prints it.
3213297Ssam  */
3313297Ssam #include <stdio.h>
3413297Ssam char buf[1024];
3513297Ssam char *getenv();
3613297Ssam 
3713297Ssam main(argc, argv) char **argv; {
3813297Ssam 	char *p;
3913297Ssam 	int rc;
4013297Ssam 
4113297Ssam 	if (argc < 2)
4213297Ssam 		p = getenv("TERM");
4313297Ssam 	else
4413297Ssam 		p = argv[1];
4513297Ssam 	rc = tgetent(buf,p);
4613297Ssam 	printf("tgetent returns %d, len=%d, text=\n'%s'\n",rc,strlen(buf),buf);
4713297Ssam }
48