xref: /original-bsd/games/ppt/ppt.c (revision ea3a8ee8)
1 /*
2  * Copyright (c) 1988 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 char copyright[] =
10 "@(#) Copyright (c) 1988 Regents of the University of California.\n\
11  All rights reserved.\n";
12 #endif /* not lint */
13 
14 #ifndef lint
15 static char sccsid[] = "@(#)ppt.c	5.5 (Berkeley) 02/03/93";
16 #endif /* not lint */
17 
18 #include <stdio.h>
19 
20 static void	putppt();
21 
22 main(argc, argv)
23 	int argc;
24 	char **argv;
25 {
26 	register int c;
27 	register char *p;
28 
29 	(void) puts("___________");
30 	if (argc > 1)
31 		while (p = *++argv)
32 			for (; *p; ++p)
33 				putppt((int)*p);
34 	else while ((c = getchar()) != EOF)
35 		putppt(c);
36 	(void) puts("___________");
37 	exit(0);
38 }
39 
40 static void
41 putppt(c)
42 	register int c;
43 {
44 	register int i;
45 
46 	(void) putchar('|');
47 	for (i = 7; i >= 0; i--) {
48 		if (i == 2)
49 			(void) putchar('.');	/* feed hole */
50 		if ((c&(1<<i)) != 0)
51 			(void) putchar('o');
52 		else
53 			(void) putchar(' ');
54 	}
55 	(void) putchar('|');
56 	(void) putchar('\n');
57 }
58