xref: /csrg-svn/usr.sbin/lpr/lptest/lptest.c (revision 55478)
122434Sdist /*
222434Sdist  * Copyright (c) 1983 Regents of the University of California.
334203Sbostic  * All rights reserved.
434203Sbostic  *
542802Sbostic  * %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*55478Sbostic static char sccsid[] = "@(#)lptest.c	5.5 (Berkeley) 07/21/92";
1634203Sbostic #endif /* not lint */
1722434Sdist 
18*55478Sbostic #include <stdlib.h>
19*55478Sbostic #include <stdio.h>
20*55478Sbostic 
2115230Sralph /*
2215230Sralph  * lptest -- line printer test program (and other devices).
2315230Sralph  */
24*55478Sbostic int
2515230Sralph main(argc, argv)
2615230Sralph 	int argc;
2715230Sralph 	char **argv;
2815230Sralph {
2915230Sralph 	int len, count;
3015230Sralph 	register i, j, fc, nc;
3115230Sralph 	char outbuf[BUFSIZ];
3215230Sralph 
3315230Sralph 	setbuf(stdout, outbuf);
3415230Sralph 	if (argc >= 2)
3515230Sralph 		len = atoi(argv[1]);
3615230Sralph 	else
3715230Sralph 		len = 79;
3815230Sralph 	if (argc >= 3)
3915230Sralph 		count = atoi(argv[2]);
4015230Sralph 	else
4115230Sralph 		count = 200;
4215230Sralph 	fc = ' ';
4315230Sralph 	for (i = 0; i < count; i++) {
4415230Sralph 		if (++fc == 0177)
4515230Sralph 			fc = ' ';
4615230Sralph 		nc = fc;
4715230Sralph 		for (j = 0; j < len; j++) {
4815230Sralph 			putchar(nc);
4915230Sralph 			if (++nc == 0177)
5015230Sralph 				nc = ' ';
5115230Sralph 		}
5215230Sralph 		putchar('\n');
5315230Sralph 	}
5415230Sralph 	(void) fflush(stdout);
55*55478Sbostic 	exit(0);
5615230Sralph }
57