Home | History | Annotate | Download | only in lptest
      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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
     16 
     17 /*
     18  * lptest -- line printer test program (and other devices).
     19  */
     20 
     21 #include <stdio.h>
     22 
     23 int
     24 main(int argc, char **argv)
     25 {
     26 	int		len, count;
     27 	register int	i, j, fc, nc;
     28 	char		outbuf[BUFSIZ];
     29 
     30 	setbuf(stdout, outbuf);
     31 	if (argc >= 2)
     32 		len = atoi(argv[1]);
     33 	else
     34 		len = 79;
     35 	if (argc >= 3)
     36 		count = atoi(argv[2]);
     37 	else
     38 		count = 200;
     39 	fc = ' ';
     40 	for (i = 0; i < count; i++) {
     41 		if (++fc == 0177)
     42 			fc = ' ';
     43 		nc = fc;
     44 		for (j = 0; j < len; j++) {
     45 			putchar(nc);
     46 			if (++nc == 0177)
     47 				nc = ' ';
     48 		}
     49 		putchar('\n');
     50 	}
     51 	(void) fflush(stdout);
     52 
     53 	return (0);
     54 }
     55