xref: /illumos-gate/usr/src/cmd/lp/cmd/lptest/lptest.c (revision 2a8bcb4e)
1 /*
2  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
7 /*	  All Rights Reserved  	*/
8 
9 /*
10  * Copyright (c) 1983 Regents of the University of California.
11  * All rights reserved.  The Berkeley software License Agreement
12  * specifies the terms and conditions for redistribution.
13  */
14 
15 /*
16  * lptest -- line printer test program (and other devices).
17  */
18 
19 #include <stdio.h>
20 
21 int
main(int argc,char ** argv)22 main(int argc, char **argv)
23 {
24 	int		len, count;
25 	register int	i, j, fc, nc;
26 	char		outbuf[BUFSIZ];
27 
28 	setbuf(stdout, outbuf);
29 	if (argc >= 2)
30 		len = atoi(argv[1]);
31 	else
32 		len = 79;
33 	if (argc >= 3)
34 		count = atoi(argv[2]);
35 	else
36 		count = 200;
37 	fc = ' ';
38 	for (i = 0; i < count; i++) {
39 		if (++fc == 0177)
40 			fc = ' ';
41 		nc = fc;
42 		for (j = 0; j < len; j++) {
43 			putchar(nc);
44 			if (++nc == 0177)
45 				nc = ' ';
46 		}
47 		putchar('\n');
48 	}
49 	(void) fflush(stdout);
50 
51 	return (0);
52 }
53