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