File:  [MW Coherent from dump] / coherent / g / usr / lib / ncurses / captoinfo.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:35 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/*
 * captoinfo:
 *	Translate termcap terminal database to terminfo source
 *	format.
 *
 *	Captoinfo reads standard input, which is assumed to be
 *	a termcap file and writes the equivalent to standard
 *	output in terminfo source format.
 *
 * Robert Viduya - Georgia Institute of Technology.
 *
 *	gitpyr!robert
 */
#include <stdio.h>

#define	bool	char
#define	TRUE	1
#define	FALSE	0

char    buffer[2048];

main (argc, argv)
int	argc;
char	**argv;
{
    int		c;

    if (argc == 2) 
	if (freopen(argv[1], "r", stdin) == NULL) {
		fprintf(stderr, "captoinfo: cannot open file %s\n", argv[1]);
		exit(1);
	}

    while ((c = getchar ()) != EOF) {
	if (c == '#') {
	    (void) putchar (c);
	    do {
		c = getchar ();
		(void) putchar (c);
	    } while (c != '\n');
	}
	else {
	    if (ungetc (c, stdin) == EOF) {
		fprintf (stderr, "ungetc failed.\n");
		exit (1);
	    }
	    get_termcap ();
	    /* Quick hack to skip empty lines. Vlad */
	    if (!strlen(buffer)) {
		printf("\n");
		continue;
	    }
	    print_name ();
	    print_bools ();
	    print_nums ();
	    print_strs ();
	}
    }
    exit (0);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.