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