xref: /csrg-svn/usr.sbin/lpr/lptest/lptest.c (revision 42802)
122434Sdist /*
222434Sdist  * Copyright (c) 1983 Regents of the University of California.
334203Sbostic  * All rights reserved.
434203Sbostic  *
5*42802Sbostic  * %sccs.include.redist.c%
622434Sdist  */
722434Sdist 
815230Sralph #ifndef lint
922434Sdist char copyright[] =
1022434Sdist "@(#) Copyright (c) 1983 Regents of the University of California.\n\
1122434Sdist  All rights reserved.\n";
1234203Sbostic #endif /* not lint */
1315230Sralph 
1422434Sdist #ifndef lint
15*42802Sbostic static char sccsid[] = "@(#)lptest.c	5.4 (Berkeley) 06/01/90";
1634203Sbostic #endif /* not lint */
1722434Sdist 
1815230Sralph /*
1915230Sralph  * lptest -- line printer test program (and other devices).
2015230Sralph  */
2115230Sralph 
2215230Sralph #include <stdio.h>
2315230Sralph 
2415230Sralph main(argc, argv)
2515230Sralph 	int argc;
2615230Sralph 	char **argv;
2715230Sralph {
2815230Sralph 	int len, count;
2915230Sralph 	register i, j, fc, nc;
3015230Sralph 	char outbuf[BUFSIZ];
3115230Sralph 
3215230Sralph 	setbuf(stdout, outbuf);
3315230Sralph 	if (argc >= 2)
3415230Sralph 		len = atoi(argv[1]);
3515230Sralph 	else
3615230Sralph 		len = 79;
3715230Sralph 	if (argc >= 3)
3815230Sralph 		count = atoi(argv[2]);
3915230Sralph 	else
4015230Sralph 		count = 200;
4115230Sralph 	fc = ' ';
4215230Sralph 	for (i = 0; i < count; i++) {
4315230Sralph 		if (++fc == 0177)
4415230Sralph 			fc = ' ';
4515230Sralph 		nc = fc;
4615230Sralph 		for (j = 0; j < len; j++) {
4715230Sralph 			putchar(nc);
4815230Sralph 			if (++nc == 0177)
4915230Sralph 				nc = ' ';
5015230Sralph 		}
5115230Sralph 		putchar('\n');
5215230Sralph 	}
5315230Sralph 	(void) fflush(stdout);
5415230Sralph }
55