xref: /original-bsd/games/ppt/ppt.c (revision a4d3ae46)
1 /*
2  * Copyright (c) 1988 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that this notice is preserved and that due credit is given
7  * to the University of California at Berkeley. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  */
12 
13 #ifndef lint
14 char copyright[] =
15 "@(#) Copyright (c) 1988 Regents of the University of California.\n\
16  All rights reserved.\n";
17 #endif /* not lint */
18 
19 #ifndef lint
20 static char sccsid[] = "@(#)ppt.c	5.2 (Berkeley) 02/08/88";
21 #endif /* not lint */
22 
23 #include <stdio.h>
24 
25 void	putppt();
26 
27 main(argc, argv)
28 	int argc;
29 	char **argv;
30 {
31 	register int c;
32 	register char *p;
33 
34 	(void) puts("___________");
35 	if (argc > 1)
36 		while (p = *++argv)
37 			for (; *p; ++p)
38 				putppt((int)*p);
39 	else while ((c = getchar()) != EOF)
40 		putppt(c);
41 	(void) puts("___________");
42 	exit(0);
43 }
44 
45 static void
46 putppt(c)
47 	register int c;
48 {
49 	register int i;
50 
51 	(void) putchar('|');
52 	for (i = 7; i >= 0; i--) {
53 		if (i == 2)
54 			(void) putchar('.');	/* feed hole */
55 		if ((c&(1<<i)) != 0)
56 			(void) putchar('o');
57 		else
58 			(void) putchar(' ');
59 	}
60 	(void) putchar('|');
61 	(void) putchar('\n');
62 }
63