1 /* 2 * Copyright (c) 1983 Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are permitted 6 * provided that this notice is preserved and that due credit is given 7 * to the University of California at Berkeley. The name of the University 8 * may not be used to endorse or promote products derived from this 9 * software without specific prior written permission. This software 10 * is provided ``as is'' without express or implied warranty. 11 */ 12 13 #ifndef lint 14 char copyright[] = 15 "@(#) Copyright (c) 1983 Regents of the University of California.\n\ 16 All rights reserved.\n"; 17 #endif /* not lint */ 18 19 #ifndef lint 20 static char sccsid[] = "@(#)lptest.c 5.2 (Berkeley) 05/05/88"; 21 #endif /* not lint */ 22 23 /* 24 * lptest -- line printer test program (and other devices). 25 */ 26 27 #include <stdio.h> 28 29 main(argc, argv) 30 int argc; 31 char **argv; 32 { 33 int len, count; 34 register i, j, fc, nc; 35 char outbuf[BUFSIZ]; 36 37 setbuf(stdout, outbuf); 38 if (argc >= 2) 39 len = atoi(argv[1]); 40 else 41 len = 79; 42 if (argc >= 3) 43 count = atoi(argv[2]); 44 else 45 count = 200; 46 fc = ' '; 47 for (i = 0; i < count; i++) { 48 if (++fc == 0177) 49 fc = ' '; 50 nc = fc; 51 for (j = 0; j < len; j++) { 52 putchar(nc); 53 if (++nc == 0177) 54 nc = ' '; 55 } 56 putchar('\n'); 57 } 58 (void) fflush(stdout); 59 } 60