xref: /csrg-svn/usr.sbin/lpr/lptest/lptest.c (revision 61851)
122434Sdist /*
2*61851Sbostic  * Copyright (c) 1983, 1993
3*61851Sbostic  *	The Regents of the University of California.  All rights reserved.
434203Sbostic  *
556131Selan  *
656255Selan  * %sccs.include.redist.c%
722434Sdist  */
822434Sdist 
915230Sralph #ifndef lint
1056269Selan static char copyright[] =
11*61851Sbostic "@(#) Copyright (c) 1983, 1993\n\
12*61851Sbostic 	The Regents of the University of California.  All rights reserved.\n";
1334203Sbostic #endif /* not lint */
1415230Sralph 
1522434Sdist #ifndef lint
16*61851Sbostic static char sccsid[] = "@(#)lptest.c	8.1 (Berkeley) 06/06/93";
1734203Sbostic #endif /* not lint */
1822434Sdist 
1955478Sbostic #include <stdlib.h>
2055478Sbostic #include <stdio.h>
2155478Sbostic 
2215230Sralph /*
2315230Sralph  * lptest -- line printer test program (and other devices).
2415230Sralph  */
2556131Selan void
main(argc,argv)2615230Sralph main(argc, argv)
2715230Sralph 	int argc;
2815230Sralph 	char **argv;
2915230Sralph {
3015230Sralph 	int len, count;
3115230Sralph 	register i, j, fc, nc;
3215230Sralph 	char outbuf[BUFSIZ];
3315230Sralph 
3415230Sralph 	setbuf(stdout, outbuf);
3515230Sralph 	if (argc >= 2)
3615230Sralph 		len = atoi(argv[1]);
3715230Sralph 	else
3815230Sralph 		len = 79;
3915230Sralph 	if (argc >= 3)
4015230Sralph 		count = atoi(argv[2]);
4115230Sralph 	else
4215230Sralph 		count = 200;
4315230Sralph 	fc = ' ';
4415230Sralph 	for (i = 0; i < count; i++) {
4515230Sralph 		if (++fc == 0177)
4615230Sralph 			fc = ' ';
4715230Sralph 		nc = fc;
4815230Sralph 		for (j = 0; j < len; j++) {
4915230Sralph 			putchar(nc);
5015230Sralph 			if (++nc == 0177)
5115230Sralph 				nc = ' ';
5215230Sralph 		}
5315230Sralph 		putchar('\n');
5415230Sralph 	}
5515230Sralph 	(void) fflush(stdout);
5655478Sbostic 	exit(0);
5715230Sralph }
58