source: trunk/minix/commands/simple/banner.c@ 17

Last change on this file since 17 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 6.6 KB
Line 
1/* banner - print a banner Author: Brian Wallis */
2
3/*****************************************************************
4 *
5 * SYSVbanner.c
6 *
7 * This is a PD version of the SYS V banner program (at least I think
8 * it is compatible to SYS V) which I wrote to use with the clock
9 * program written by:
10 ** DCF, Inc.
11 ** 14623 North 49th Place
12 ** Scottsdale, AZ 85254
13 * and published in the net comp.sources.misc newsgroup in early July
14 * since the BSD banner program works quite differently.
15 *
16 * There is no copyright or responsibility accepted for the use
17 * of this software.
18 *
19 * Brian Wallis, brw@jim.odr.oz, 4 July 1988
20 *
21 *****************************************************************/
22
23#include <string.h>
24#include <stdio.h>
25
26_PROTOTYPE(int main, (int argc, char **argv));
27
28char *glyphs[] = {
29 " @@@ @@ @@ @ @ @@@@@ @@ @@@ ",
30 " @@@ @@ @@ @ @ @ @ @@@ @ @ @ @@@ ",
31 " @@@ @ @ @@@@@@@@ @ @@ @ @@ @ ",
32 " @ @ @ @@@@@ @ @@@ @ ",
33 " @@@@@@@ @ @ @ @ @ @ ",
34 " @@@ @ @ @ @ @ @ @@ @ @ ",
35 " @@@ @ @ @@@@@ @ @@ @@@@ @ ",
36
37 " @@ @@ @",
38 " @ @ @ @ @ @ ",
39 " @ @ @ @ @ @ ",
40 " @ @ @@@@@@@ @@@@@ @@@ @@@@@ @ ",
41 " @ @ @ @ @ @@@ @ ",
42 " @ @ @ @ @ @ @@@ @ ",
43 " @@ @@ @ @@@ @ ",
44
45 " @@@ @ @@@@@ @@@@@ @ @@@@@@@ @@@@@ @@@@@@@",
46 " @ @ @@ @ @@ @@ @ @ @ @@ @ ",
47 "@ @ @ @ @ @ @@ @ @ @ @ ",
48 "@ @ @ @ @@@@@ @@@@@ @@@@@@@ @@@@@ @@@@@@ @ ",
49 "@ @ @ @ @ @ @ @@ @ @ ",
50 " @ @ @ @ @ @ @ @ @@ @ @ ",
51 " @@@ @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@@@@@ @ @@@@@ @ ",
86 " @ @ @ @ @ @ @ @ @ @ ",
87 " @ @ @ @ @ @ @ @ @ @ ",
88 " @ @ @ @ @ @ ",
89 " @ @ @ @ @ @ @ ",
90 " @ @ @ @ @ @ @ ",
91 "@ @ @ @@@@@@@ @@@@@ @ @@@@@ @@@@@@@",
92
93 " @@@ ",
94 " @@@ @@ @@@@@ @@@@ @@@@@ @@@@@@ @@@@@@ @@@@ ",
95 " @ @ @ @ @ @ @ @ @ @ @ @ @",
96 " @ @ @ @@@@@ @ @ @ @@@@@ @@@@@ @ ",
97 " @@@@@@ @ @ @ @ @ @ @ @ @@@",
98 " @ @ @ @ @ @ @ @ @ @ @ @",
99 " @ @ @@@@@ @@@@ @@@@@ @@@@@@ @ @@@@ ",
100
101 " ",
102 " @ @ @ @ @ @ @ @ @ @ @ @@@@ ",
103 " @ @ @ @ @ @ @ @@ @@ @@ @ @ @",
104 " @@@@@@ @ @ @@@@ @ @ @@ @ @ @ @ @ @",
105 " @ @ @ @ @ @ @ @ @ @ @ @ @ @",
106 " @ @ @ @ @ @ @ @ @ @ @ @@ @ @",
107 " @ @ @ @@@@ @ @ @@@@@@ @ @ @ @ @@@@ ",
108
109 " ",
110 " @@@@@ @@@@ @@@@@ @@@@ @@@@@ @ @ @ @ @ @",
111 " @ @ @ @ @ @ @ @ @ @ @ @ @ @",
112 " @ @ @ @ @ @ @@@@ @ @ @ @ @ @ @",
113 " @@@@@ @ @ @ @@@@@ @ @ @ @ @ @ @ @@ @",
114 " @ @ @ @ @ @ @ @ @ @ @ @ @@ @@",
115 " @ @@@ @ @ @ @@@@ @ @@@@ @@ @ @",
116
117 " @@@ @ @@@ @@ @ @ @ @",
118 " @ @ @ @ @@@@@@ @ @ @ @ @ @ @ @ @ ",
119 " @ @ @ @ @ @ @ @ @@ @ @ @ @",
120 " @@ @ @ @@ @@ @ @ @ ",
121 " @@ @ @ @ @ @ @ @ @ @",
122 " @ @ @ @ @ @ @ @ @ @ ",
123 " @ @ @ @@@@@@ @@@ @ @@@ @ @ @ @"
124};
125
126int main(argc, argv)
127int argc;
128char *argv[];
129{
130 int a, b, c, len, ind;
131 char line[80];
132
133 for (argv++; --argc; argv++) {
134 len = strlen(*argv);
135 if (len > 10) len = 10;
136 for (a = 0; a < 7; a++) {
137 for (b = 0; b < len; b++) {
138 if ((ind = (*argv)[b] - ' ') < 0) ind = 0;
139 for (c = 0; c < 7; c++) {
140 line[b * 8 + c] = glyphs[(ind / 8 * 7) + a][(ind % 8 * 7) + c] == '@' ? ind + ' ' : ' ';
141 }
142 line[b * 8 + 7] = ' ';
143 }
144 for (b = len * 8 - 1; b >= 0; b--) {
145 if (line[b] != ' ') break;
146 line[b] = '\0';
147 }
148 printf("%s\n", line);
149 }
150 printf("\n");
151 }
152 return(0);
153}
Note: See TracBrowser for help on using the repository browser.