Annotation of coherent/g/usr/lib/ncurses/captoinfo.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * captoinfo:
        !             3:  *     Translate termcap terminal database to terminfo source
        !             4:  *     format.
        !             5:  *
        !             6:  *     Captoinfo reads standard input, which is assumed to be
        !             7:  *     a termcap file and writes the equivalent to standard
        !             8:  *     output in terminfo source format.
        !             9:  *
        !            10:  * Robert Viduya - Georgia Institute of Technology.
        !            11:  *
        !            12:  *     gitpyr!robert
        !            13:  */
        !            14: #include <stdio.h>
        !            15: 
        !            16: #define        bool    char
        !            17: #define        TRUE    1
        !            18: #define        FALSE   0
        !            19: 
        !            20: char    buffer[2048];
        !            21: 
        !            22: main (argc, argv)
        !            23: int    argc;
        !            24: char   **argv;
        !            25: {
        !            26:     int                c;
        !            27: 
        !            28:     if (argc == 2) 
        !            29:        if (freopen(argv[1], "r", stdin) == NULL) {
        !            30:                fprintf(stderr, "captoinfo: cannot open file %s\n", argv[1]);
        !            31:                exit(1);
        !            32:        }
        !            33: 
        !            34:     while ((c = getchar ()) != EOF) {
        !            35:        if (c == '#') {
        !            36:            (void) putchar (c);
        !            37:            do {
        !            38:                c = getchar ();
        !            39:                (void) putchar (c);
        !            40:            } while (c != '\n');
        !            41:        }
        !            42:        else {
        !            43:            if (ungetc (c, stdin) == EOF) {
        !            44:                fprintf (stderr, "ungetc failed.\n");
        !            45:                exit (1);
        !            46:            }
        !            47:            get_termcap ();
        !            48:            /* Quick hack to skip empty lines. Vlad */
        !            49:            if (!strlen(buffer)) {
        !            50:                printf("\n");
        !            51:                continue;
        !            52:            }
        !            53:            print_name ();
        !            54:            print_bools ();
        !            55:            print_nums ();
        !            56:            print_strs ();
        !            57:        }
        !            58:     }
        !            59:     exit (0);
        !            60: }

unix.superglobalmegacorp.com

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