Annotation of 42BSD/usr.lib/lpr/lptest.c, revision 1.1

1.1     ! root        1: #ifndef lint
        !             2: static char sccsid[] = "@(#)lptest.c   4.1 (Berkeley) 10/14/83";
        !             3: #endif
        !             4: 
        !             5: /*
        !             6:  * lptest -- line printer test program (and other devices).
        !             7:  */
        !             8: 
        !             9: #include <stdio.h>
        !            10: 
        !            11: main(argc, argv)
        !            12:        int argc;
        !            13:        char **argv;
        !            14: {
        !            15:        int len, count;
        !            16:        register i, j, fc, nc;
        !            17:        char outbuf[BUFSIZ];
        !            18: 
        !            19:        setbuf(stdout, outbuf);
        !            20:        if (argc >= 2)
        !            21:                len = atoi(argv[1]);
        !            22:        else
        !            23:                len = 79;
        !            24:        if (argc >= 3)
        !            25:                count = atoi(argv[2]);
        !            26:        else
        !            27:                count = 200;
        !            28:        fc = ' ';
        !            29:        for (i = 0; i < count; i++) {
        !            30:                if (++fc == 0177)
        !            31:                        fc = ' ';
        !            32:                nc = fc;
        !            33:                for (j = 0; j < len; j++) {
        !            34:                        putchar(nc);
        !            35:                        if (++nc == 0177)
        !            36:                                nc = ' ';
        !            37:                }
        !            38:                putchar('\n');
        !            39:        }
        !            40:        (void) fflush(stdout);
        !            41: }

unix.superglobalmegacorp.com

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