xref: /original-bsd/usr.sbin/lpr/lptest/lptest.c (revision ad6756fe)
1e34be85fSdist /*
2*ad6756feSbostic  * Copyright (c) 1983, 1993
3*ad6756feSbostic  *	The Regents of the University of California.  All rights reserved.
4b1f76507Sbostic  *
597650589Selan  *
621dec7c2Selan  * %sccs.include.redist.c%
7e34be85fSdist  */
8e34be85fSdist 
900303c97Sralph #ifndef lint
10e6fdcb1aSelan static char copyright[] =
11*ad6756feSbostic "@(#) Copyright (c) 1983, 1993\n\
12*ad6756feSbostic 	The Regents of the University of California.  All rights reserved.\n";
13b1f76507Sbostic #endif /* not lint */
14e34be85fSdist 
15e34be85fSdist #ifndef lint
16*ad6756feSbostic static char sccsid[] = "@(#)lptest.c	8.1 (Berkeley) 06/06/93";
17b1f76507Sbostic #endif /* not lint */
1800303c97Sralph 
19001c16bdSbostic #include <stdlib.h>
20001c16bdSbostic #include <stdio.h>
21001c16bdSbostic 
2200303c97Sralph /*
2300303c97Sralph  * lptest -- line printer test program (and other devices).
2400303c97Sralph  */
2597650589Selan void
main(argc,argv)2600303c97Sralph main(argc, argv)
2700303c97Sralph 	int argc;
2800303c97Sralph 	char **argv;
2900303c97Sralph {
3000303c97Sralph 	int len, count;
3100303c97Sralph 	register i, j, fc, nc;
3200303c97Sralph 	char outbuf[BUFSIZ];
3300303c97Sralph 
3400303c97Sralph 	setbuf(stdout, outbuf);
3500303c97Sralph 	if (argc >= 2)
3600303c97Sralph 		len = atoi(argv[1]);
3700303c97Sralph 	else
3800303c97Sralph 		len = 79;
3900303c97Sralph 	if (argc >= 3)
4000303c97Sralph 		count = atoi(argv[2]);
4100303c97Sralph 	else
4200303c97Sralph 		count = 200;
4300303c97Sralph 	fc = ' ';
4400303c97Sralph 	for (i = 0; i < count; i++) {
4500303c97Sralph 		if (++fc == 0177)
4600303c97Sralph 			fc = ' ';
4700303c97Sralph 		nc = fc;
4800303c97Sralph 		for (j = 0; j < len; j++) {
4900303c97Sralph 			putchar(nc);
5000303c97Sralph 			if (++nc == 0177)
5100303c97Sralph 				nc = ' ';
5200303c97Sralph 		}
5300303c97Sralph 		putchar('\n');
5400303c97Sralph 	}
5500303c97Sralph 	(void) fflush(stdout);
56001c16bdSbostic 	exit(0);
5700303c97Sralph }
58