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

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1983 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: char copyright[] =
        !             9: "@(#) Copyright (c) 1983 Regents of the University of California.\n\
        !            10:  All rights reserved.\n";
        !            11: #endif not lint
        !            12: 
        !            13: #ifndef lint
        !            14: static char sccsid[] = "@(#)lptest.c   5.1 (Berkeley) 6/6/85";
        !            15: #endif not lint
        !            16: 
        !            17: /*
        !            18:  * lptest -- line printer test program (and other devices).
        !            19:  */
        !            20: 
        !            21: #include <stdio.h>
        !            22: 
        !            23: main(argc, argv)
        !            24:        int argc;
        !            25:        char **argv;
        !            26: {
        !            27:        int len, count;
        !            28:        register i, j, fc, nc;
        !            29:        char outbuf[BUFSIZ];
        !            30: 
        !            31:        setbuf(stdout, outbuf);
        !            32:        if (argc >= 2)
        !            33:                len = atoi(argv[1]);
        !            34:        else
        !            35:                len = 79;
        !            36:        if (argc >= 3)
        !            37:                count = atoi(argv[2]);
        !            38:        else
        !            39:                count = 200;
        !            40:        fc = ' ';
        !            41:        for (i = 0; i < count; i++) {
        !            42:                if (++fc == 0177)
        !            43:                        fc = ' ';
        !            44:                nc = fc;
        !            45:                for (j = 0; j < len; j++) {
        !            46:                        putchar(nc);
        !            47:                        if (++nc == 0177)
        !            48:                                nc = ' ';
        !            49:                }
        !            50:                putchar('\n');
        !            51:        }
        !            52:        (void) fflush(stdout);
        !            53: }

unix.superglobalmegacorp.com

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