Hiya!
Hier nochmal eine portable(re) banner-Source (jaja, ich weiss, das ist
schon das zweite Posting davon. Ich mag's halt so gern :-).
Hier die Syntax:
banner [<opts>] {<string> [<opts>]}
Optionen:
-i Schraegschrift (italics)
-d doppelte Groesse
-z liest Text von standard input
-z=<path> liest Text von File
-c=<char> Buchstaben werden mit dem Zeichen <char> ausgegeben
(Default ist '*')
-s Zeichen werden mit den entsprechenden Buchstaben ausgegeben,
Beispiel:
ccc H H
c H H
c als c und H als HHHHHHH
ccc H H
H H
Achja: Ein makefile hab' ich mir auch geschenkt.
Fuer *NIX: cc banner.c font.c -o banner
Fuer OSK: cc -qxit=/dd -bg banner.c font.c -f=banner
Viel Spass (und 'mesg n' nicht vergessen! :-)
Wolfgang
---- cut here ---- cut here ---- cut here ---- cut here ---- cut here ----
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
# banner.c
# font.c
# This archive created: Thu Jun 30 23:19:42 1988
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'banner.c'
then
echo shar: "will not over-write existing file 'banner.c'"
else
cat << \SHAR_EOF > 'banner.c'
/*
* The ultimative banner.
*
* Written in 1987 by Wolfgang Ocker, reccoware systems, Puchheim
*
* It's *not* fast, but nice ...
*
* Tested on OS-9/68000 and Ultrix V2.2
*/
#include <stdio.h>
#ifdef OSK
#include <modes.h>
#else
#define S_IREAD 0
#endif
#define TRUE 1
#define FALSE 0
extern unsigned char charset; /* Zeichensatz */
extern int errno;
#ifdef OSK
/*
* Signal Handler (Dummy)
*/
int sighandler()
{
}
#endif
/*
* m a i n
*/
main(argc, argv)
int argc;
char *argv[];
{
char *str, strbuf[200];
int linenum, chnum, i, j, k, count, strnum;
unsigned char ch;
int ch_off;
unsigned char *ch_addr;
unsigned char *font;
int italic, dblsize, samechar;
char bannerchar;
FILE *infp;
char *from, *plife;
italic = dblsize = samechar = FALSE;
strnum = 0;
from = NULL;
bannerchar = '*';
plife = NULL;
/*
* Get the arguments. I *hate* getopt(:-). This works nice (and is
* simpler).
*/
for (i = 1; i < argc; i++)
if (argv[i][0] == '-')
for (j = 1; j < strlen(argv[i]); j++)
switch(tolower(argv[i][j])) {
case '?':
usage();
exit(1);
case 'i': /* italic printing */
italic = TRUE;
break;
case 'd': /* double sized characters */
dblsize = TRUE;
break;
case 's': /* use character to build large char, e.g.
* c becomes
*
* ccc
* c
* c (or so ...)
* ccc
*/
samechar = TRUE;
break;
#ifdef OSK
case 'l':
plife = argv[i] + j + (argv[i][j+1] == '=' ? 2 : 1);
j = strlen(argv[i]);
break;
#endif
case 'c': /* character for banner */
j += argv[i][j+1] == '=' ? 2 : 1;
bannerchar = argv[i][j];
break;
case 'z': /* get text from ... */
if (from) {
usage();
fputs("multiple 'z' option not allowed\n", stderr);
exit(1);
}
from = argv[i] + j + (argv[i][j+1] == '=' ? 2 : 1);
j = strlen(argv[i]);
break;
default:
usage();
fprintf(stderr, "banner: unknown option '%c'\n", argv[i][j]);
exit(1);
}
else
strnum++; /* count number of strings */
if (strnum == 0 && from == NULL) {
usage();
#ifdef OSK
exit(_errmsg(1, "no string given\n"));
#else
exit(fputs("no string given\n", stderr), 1);
#endif
}
if (strnum && from) {
usage();
#ifdef OSK
exit(_errmsg(1, "'z' option not allowed if string(s) given\n"));
#else
exit(fputs("'z' option not allowed if string(s) given\n", stderr), 1);
#endif
}
if (from) {
if (from[0]) {
if ((infp = fopen(from, "r")) == NULL)
#ifdef OSK
exit(_errmsg(errno, "can't open '%s'\n", from));
#else
exit(fprintf(stderr, "can't open '%s'\n", from), errno);
#endif
}
else
infp = stdin;
}
#ifdef OSK
if (plife && !strcmp(plife, "dont_kill_me"))
intercept(sighandler);
#endif
font = &charset;
str = strbuf;
i = 1;
while (TRUE) {
if (from) { /* read strings from file/stdin */
if (fgets(strbuf, sizeof(strbuf)-1, infp) == NULL)
break;
strbuf[strlen(strbuf)-1] = '\0';
}
else { /* get strings from argument line */
if ((str = argv[i++]) == NULL)
break;
if (str[0] == '-')
continue;
}
for (linenum = 0; linenum < 8; linenum++) { /* 8 lines per char */
for (j = 0; j < (dblsize ? 2 : 1); j++) {
putchar('\n');
if (italic) /* shift for italics */
for (k = linenum; k < 7; k++)
fputs(dblsize ? " " : " ", stdout);
for (chnum = 0; chnum < strlen(str); chnum++) {
ch = str[chnum];
ch_off = (int) ch * 8;
ch_addr = font + ch_off + linenum;
outline(ch, *ch_addr, dblsize, bannerchar, samechar);
}
}
}
}
putchar('\n');
}
/*
* o u t l i n e
*/
outline(outchar, outbyte, dblsize, bannerchar, samechar)
char outchar, outbyte, bannerchar;
int dblsize, samechar;
{
int bc, j;
for (bc = 7; bc >= 0; bc--)
for (j = 0; j < (dblsize ? 2 : 1); j++)
if (outbyte & (0x01 << bc))
putchar((samechar) ? outchar : bannerchar);
else
putchar(' ');
}
/*
* u s a g e
*/
usage()
{
fputs("Syntax: banner [<opts>] {<string>} [<opts>]\n", stderr);
fputs("Function: prints a banner to stdout\n", stderr);
fputs("Options:\n", stderr);
fputs(" -i prints italic\n", stderr);
fputs(" -d double size\n", stderr);
fputs(" -c=<char> character\n", stderr);
fputs(" -s use same character\n", stderr);
fputs(" -z read strings from standard input\n", stderr);
fputs(" -z=<file> read strings from <file>\n", stderr);
}
SHAR_EOF
fi
if test -f 'font.c'
then
echo shar: "will not over-write existing file 'font.c'"
else
cat << \SHAR_EOF > 'font.c'
unsigned char charset[] = {
0, 0, 0, 0, 0, 0, 0, 0,
126, 129, 165, 129, 189, 153, 129, 126,
126, 255, 219, 255, 195, 231, 255, 126,
108, 254, 254, 254, 124, 56, 16, 0,
16, 56, 124, 254, 124, 56, 16, 0,
56, 124, 56, 254, 254, 124, 56, 124,
16, 16, 56, 124, 254, 124, 56, 124,
0, 0, 24, 60, 60, 24, 0, 0,
255, 255, 231, 195, 195, 231, 255, 255,
0, 60, 102, 66, 66, 102, 60, 0,
255, 195, 153, 189, 189, 153, 195, 255,
15, 7, 15, 125, 204, 204, 204, 120,
60, 102, 102, 102, 60, 24, 126, 24,
63, 51, 63, 48, 48, 112, 240, 224,
127, 99, 127, 99, 99, 103, 230, 192,
153, 90, 60, 231, 231, 60, 90, 153,
128, 224, 248, 254, 248, 224, 128, 0,
2, 14, 62, 254, 62, 14, 2, 0,
24, 60, 126, 24, 24, 126, 60, 24,
102, 102, 102, 102, 102, 0, 102, 0,
127, 219, 219, 123, 27, 27, 27, 0,
62, 99, 56, 108, 108, 56, 204, 120,
0, 0, 0, 0, 126, 126, 126, 0,
24, 60, 126, 24, 126, 60, 24, 255,
24, 60, 126, 24, 24, 24, 24, 0,
24, 24, 24, 24, 126, 60, 24, 0,
0, 24, 12, 254, 12, 24, 0, 0,
0, 48, 96, 254, 96, 48, 0, 0,
0, 0, 192, 192, 192, 254, 0, 0,
0, 36, 102, 255, 102, 36, 0, 0,
0, 24, 60, 126, 255, 255, 0, 0,
0, 255, 255, 126, 60, 24, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
48, 120, 120, 48, 48, 0, 48, 0,
108, 108, 108, 0, 0, 0, 0, 0,
108, 108, 254, 108, 254, 108, 108, 0,
48, 124, 192, 120, 12, 248, 48, 0,
0, 198, 204, 24, 48, 102, 198, 0,
56, 108, 56, 118, 220, 204, 118, 0,
96, 96, 192, 0, 0, 0, 0, 0,
24, 48, 96, 96, 96, 48, 24, 0,
96, 48, 24, 24, 24, 48, 96, 0,
0, 102, 60, 255, 60, 102, 0, 0,
0, 48, 48, 252, 48, 48, 0, 0,
0, 0, 0, 0, 0, 48, 48, 96,
0, 0, 0, 252, 0, 0, 0, 0,
0, 0, 0, 0, 0, 48, 48, 0,
6, 12, 24, 48, 96, 192, 128, 0,
124, 198, 206, 222, 246, 230, 124, 0,
48, 112, 48, 48, 48, 48, 252, 0,
120, 204, 12, 56, 96, 204, 252, 0,
120, 204, 12, 56, 12, 204, 120, 0,
28, 60, 108, 204, 254, 12, 30, 0,
252, 192, 248, 12, 12, 204, 120, 0,
56, 96, 192, 248, 204, 204, 120, 0,
252, 204, 12, 24, 48, 48, 48, 0,
120, 204, 204, 120, 204, 204, 120, 0,
120, 204, 204, 124, 12, 24, 112, 0,
0, 48, 48, 0, 0, 48, 48, 0,
0, 48, 48, 0, 0, 48, 48, 96,
24, 48, 96, 192, 96, 48, 24, 0,
0, 0, 252, 0, 0, 252, 0, 0,
96, 48, 24, 12, 24, 48, 96, 0,
120, 204, 12, 24, 48, 0, 48, 0,
124, 198, 222, 222, 222, 192, 120, 0,
48, 120, 204, 204, 252, 204, 204, 0,
252, 102, 102, 124, 102, 102, 252, 0,
60, 102, 192, 192, 192, 102, 60, 0,
248, 108, 102, 102, 102, 108, 248, 0,
254, 98, 104, 120, 104, 98, 254, 0,
254, 98, 104, 120, 104, 96, 240, 0,
60, 102, 192, 192, 206, 102, 62, 0,
204, 204, 204, 252, 204, 204, 204, 0,
120, 48, 48, 48, 48, 48, 120, 0,
30, 12, 12, 12, 204, 204, 120, 0,
230, 102, 108, 120, 108, 102, 230, 0,
240, 96, 96, 96, 98, 102, 254, 0,
198, 238, 254, 254, 214, 198, 198, 0,
198, 230, 246, 222, 206, 198, 198, 0,
56, 108, 198, 198, 198, 108, 56, 0,
252, 102, 102, 124, 96, 96, 240, 0,
120, 204, 204, 204, 220, 120, 28, 0,
252, 102, 102, 124, 108, 102, 230, 0,
120, 204, 224, 112, 28, 204, 120, 0,
252, 180, 48, 48, 48, 48, 120, 0,
204, 204, 204, 204, 204, 204, 252, 0,
204, 204, 204, 204, 204, 120, 48, 0,
198, 198, 198, 214, 254, 238, 198, 0,
198, 198, 108, 56, 56, 108, 198, 0,
204, 204, 204, 120, 48, 48, 120, 0,
254, 198, 140, 24, 50, 102, 254, 0,
120, 96, 96, 96, 96, 96, 120, 0,
192, 96, 48, 24, 12, 6, 2, 0,
120, 24, 24, 24, 24, 24, 120, 0,
16, 56, 108, 198, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 255,
48, 48, 24, 0, 0, 0, 0, 0,
0, 0, 120, 12, 124, 204, 118, 0,
224, 96, 96, 124, 102, 102, 220, 0,
0, 0, 120, 204, 192, 204, 120, 0,
28, 12, 12, 124, 204, 204, 118, 0,
0, 0, 120, 204, 252, 192, 120, 0,
56, 108, 96, 240, 96, 96, 240, 0,
0, 0, 118, 204, 204, 124, 12, 248,
224, 96, 108, 118, 102, 102, 230, 0,
48, 0, 112, 48, 48, 48, 120, 0,
12, 0, 12, 12, 12, 204, 204, 120,
224, 96, 102, 108, 120, 108, 230, 0,
112, 48, 48, 48, 48, 48, 120, 0,
0, 0, 204, 254, 254, 214, 198, 0,
0, 0, 248, 204, 204, 204, 204, 0,
0, 0, 120, 204, 204, 204, 120, 0,
0, 0, 220, 102, 102, 124, 96, 240,
0, 0, 118, 204, 204, 124, 12, 30,
0, 0, 220, 118, 102, 96, 240, 0,
0, 0, 124, 192, 120, 12, 248, 0,
16, 48, 124, 48, 48, 52, 24, 0,
0, 0, 204, 204, 204, 204, 118, 0,
0, 0, 204, 204, 204, 120, 48, 0,
0, 0, 198, 214, 254, 254, 108, 0,
0, 0, 198, 108, 56, 108, 198, 0,
0, 0, 204, 204, 204, 124, 12, 248,
0, 0, 252, 152, 48, 100, 252, 0,
28, 48, 48, 224, 48, 48, 28, 0,
24, 24, 24, 0, 24, 24, 24, 0,
224, 48, 48, 28, 48, 48, 224, 0,
118, 220, 0, 0, 0, 0, 0, 0,
0, 16, 56, 108, 198, 198, 254, 0,
120, 204, 192, 204, 120, 24, 12, 120,
0, 204, 0, 204, 204, 204, 126, 0,
28, 0, 120, 204, 252, 192, 120, 0,
126, 195, 60, 6, 62, 102, 63, 0,
204, 0, 120, 12, 124, 204, 126, 0,
224, 0, 120, 12, 124, 204, 126, 0,
48, 48, 120, 12, 124, 204, 126, 0,
0, 0, 120, 192, 192, 120, 12, 56,
126, 195, 60, 102, 126, 96, 60, 0,
204, 0, 120, 204, 252, 192, 120, 0,
224, 0, 120, 204, 252, 192, 120, 0,
204, 0, 112, 48, 48, 48, 120, 0,
124, 198, 56, 24, 24, 24, 60, 0,
224, 0, 112, 48, 48, 48, 120, 0,
198, 56, 108, 198, 254, 198, 198, 0,
48, 48, 0, 120, 204, 252, 204, 0,
28, 0, 252, 96, 120, 96, 252, 0,
0, 0, 127, 12, 127, 204, 127, 0,
62, 108, 204, 254, 204, 204, 206, 0,
120, 204, 0, 120, 204, 204, 120, 0,
0, 204, 0, 120, 204, 204, 120, 0,
0, 224, 0, 120, 204, 204, 120, 0,
120, 204, 0, 204, 204, 204, 126, 0,
0, 224, 0, 204, 204, 204, 126, 0,
0, 204, 0, 204, 204, 124, 12, 248,
195, 24, 60, 102, 102, 60, 24, 0,
204, 0, 204, 204, 204, 204, 120, 0,
24, 24, 126, 192, 192, 126, 24, 24,
56, 108, 100, 240, 96, 230, 252, 0,
204, 204, 120, 252, 48, 252, 48, 48,
248, 204, 204, 250, 198, 207, 198, 199,
14, 27, 24, 60, 24, 24, 216, 112,
28, 0, 120, 12, 124, 204, 126, 0,
56, 0, 112, 48, 48, 48, 120, 0,
0, 28, 0, 120, 204, 204, 120, 0,
0, 28, 0, 204, 204, 204, 126, 0,
0, 248, 0, 248, 204, 204, 204, 0,
252, 0, 204, 236, 252, 220, 204, 0,
60, 108, 108, 62, 0, 126, 0, 0,
56, 108, 108, 56, 0, 124, 0, 0,
48, 0, 48, 96, 192, 204, 120, 0,
0, 0, 0, 252, 192, 192, 0, 0,
0, 0, 0, 252, 12, 12, 0, 0,
195, 198, 204, 222, 51, 102, 204, 15,
195, 198, 204, 219, 55, 111, 207, 3,
24, 24, 0, 24, 24, 24, 24, 0,
0, 51, 102, 204, 102, 51, 0, 0,
0, 204, 102, 51, 102, 204, 0, 0,
34, 136, 34, 136, 34, 136, 34, 136,
85, 170, 85, 170, 85, 170, 85, 170,
219, 119, 219, 238, 219, 119, 219, 238,
24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 248, 24, 24, 24,
24, 24, 248, 24, 248, 24, 24, 24,
54, 54, 54, 54, 246, 54, 54, 54,
0, 0, 0, 0, 254, 54, 54, 54,
0, 0, 248, 24, 248, 24, 24, 24,
54, 54, 246, 6, 246, 54, 54, 54,
54, 54, 54, 54, 54, 54, 54, 54,
0, 0, 254, 6, 246, 54, 54, 54,
54, 54, 246, 6, 254, 0, 0, 0,
54, 54, 54, 54, 254, 0, 0, 0,
24, 24, 248, 24, 248, 0, 0, 0,
0, 0, 0, 0, 248, 24, 24, 24,
24, 24, 24, 24, 31, 0, 0, 0,
24, 24, 24, 24, 255, 0, 0, 0,
0, 0, 0, 0, 255, 24, 24, 24,
24, 24, 24, 24, 31, 24, 24, 24,
0, 0, 0, 0, 255, 0, 0, 0,
24, 24, 24, 24, 255, 24, 24, 24,
24, 24, 31, 24, 31, 24, 24, 24,
54, 54, 54, 54, 55, 54, 54, 54,
54, 54, 55, 48, 63, 0, 0, 0,
0, 0, 63, 48, 55, 54, 54, 54,
54, 54, 247, 0, 255, 0, 0, 0,
0, 0, 255, 0, 247, 54, 54, 54,
54, 54, 55, 48, 55, 54, 54, 54,
0, 0, 255, 0, 255, 0, 0, 0,
54, 54, 247, 0, 247, 54, 54, 54,
24, 24, 255, 0, 255, 0, 0, 0,
54, 54, 54, 54, 255, 0, 0, 0,
0, 0, 255, 0, 255, 24, 24, 24,
0, 0, 0, 0, 255, 54, 54, 54,
54, 54, 54, 54, 63, 0, 0, 0,
24, 24, 31, 24, 31, 0, 0, 0,
0, 0, 31, 24, 31, 24, 24, 24,
0, 0, 0, 0, 63, 54, 54, 54,
54, 54, 54, 54, 255, 54, 54, 54,
24, 24, 255, 24, 255, 24, 24, 24,
24, 24, 24, 24, 248, 0, 0, 0,
0, 0, 0, 0, 31, 24, 24, 24,
255, 255, 255, 255, 255, 255, 255, 255,
0, 0, 0, 0, 255, 255, 255, 255,
240, 240, 240, 240, 240, 240, 240, 240,
15, 15, 15, 15, 15, 15, 15, 15,
255, 255, 255, 255, 0, 0, 0, 0,
0, 0, 118, 220, 200, 220, 118, 0,
0, 120, 204, 248, 204, 248, 192, 192,
0, 252, 204, 192, 192, 192, 192, 0,
0, 254, 108, 108, 108, 108, 108, 0,
252, 204, 96, 48, 96, 204, 252, 0,
0, 0, 126, 216, 216, 216, 112, 0,
0, 102, 102, 102, 102, 124, 96, 192,
0, 118, 220, 24, 24, 24, 24, 0,
252, 48, 120, 204, 204, 120, 48, 252,
56, 108, 198, 254, 198, 108, 56, 0,
56, 108, 198, 198, 108, 108, 238, 0,
28, 48, 24, 124, 204, 204, 120, 0,
0, 0, 126, 219, 219, 126, 0, 0,
6, 12, 126, 219, 219, 126, 96, 192,
56, 96, 192, 248, 192, 96, 56, 0,
120, 204, 204, 204, 204, 204, 204, 0,
0, 252, 0, 252, 0, 252, 0, 0,
48, 48, 252, 48, 48, 0, 252, 0,
96, 48, 24, 48, 96, 0, 252, 0,
24, 48, 96, 48, 24, 0, 252, 0,
14, 27, 27, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 216, 216, 112,
48, 48, 0, 252, 0, 48, 48, 0,
0, 118, 220, 0, 118, 220, 0, 0,
56, 108, 108, 56, 0, 0, 0, 0,
0, 0, 0, 24, 24, 0, 0, 0,
0, 0, 0, 0, 24, 0, 0, 0,
15, 12, 12, 12, 236, 108, 60, 28 };
SHAR_EOF
fi
exit 0
# End of shell archive
---- cut here ---- cut here ---- cut here ---- cut here ---- cut here ----
+-----------------------------+------------------------------+
| Wolfgang Ocker | (tmpmbx, altger)!recco!weo |
| Lochhauserstr. 35a +------------------------------+
| D-8039 Puchheim | reccoware systems |
| Voice: +49 89 80 77 02 | Huh, What? Where am I? |
+-----------------------------+------------------------------+
--
| Frank Kaefer | f...@stasys.sta.sub.org | Starnberg, Germany |
| Compuserve: 72427,2101 | Internet: frank....@Sun.COM |
| unido!sunde!fkaefer | fka...@Germany.Sun.COM |
Ahaaa. Seit Jahren habe ich hier das Binary von diesem Banner rumliegen,
und wusste nicht, woher es kam. Jetzt weiss ich's. :-)
-Achim