[comp.sources.misc] v03i071: SYSV-like banner program for clock

root@basser.UUCP (07/11/88)

comp.sources.misc: Volume 3, Issue 71
Submitted-by: Brian Wallis <brw@jim.odr.oz.AU>
Archive-Name: SYSVbanner


I wanted to run the clock program (v03i056) on a BSD system and
discovered that the BSD banner program has not much in common with the
SYSV banner. So I wrote a SYSV banner program. I've never seen a SYSV
system so how similar this is I've no idea, it produces up to 10 chars
across the screen from each argument it is given and the chars are in
an 8*8 matrix with the right and bottom chars blank for seperators.
This has been tested on Ultrix 2.0 on a MicroVax II. It should compile
and run anywhere there is a C compiler.

Remove This and the signature at the end, save in SYSVbanner.c and
compile with:
  cc -o SYSVbanner SYSVbanner.c
(check that no tabs have been inserted in 'glyphs')

--------------------------------Cut Here--------------------------------
/*****************************************************************
 * 
 * SYSVbanner.c
 * 
 * This is a PD version of the SYS V banner program (at least I think 
 * it is compatible to SYS V) which I wrote to use with the clock 
 * program written by:
 **     DCF, Inc.
 **     14623 North 49th Place
 **     Scottsdale, AZ 85254
 * and published in the net comp.sources.misc newsgroup in early July 
 * since the BSD banner program works quite differently.
 * 
 * There is no copyright or responsibility accepted for the use
 * of this software.
 * 
 * Brian Wallis, brw@jim.odr.oz, 4 July 1988
 *
 *****************************************************************/

char *glyphs[] = {
"         @@@  @@@ @@@  @ @   @@@@@ @@@   @  @@     @@@  ",
"         @@@  @@@ @@@  @ @  @  @  @@ @  @  @  @    @@@   ",
"         @@@   @   @ @@@@@@@@  @   @@@ @    @@      @   ",
"          @            @ @   @@@@@    @    @@@     @    ",
"                     @@@@@@@   @  @  @ @@@@   @ @       ",
"         @@@           @ @  @  @  @ @  @ @@    @        ",
"         @@@           @ @   @@@@@ @   @@@ @@@@ @       ",

"   @@    @@                                            @",
"  @        @   @   @    @                             @ ",
" @          @   @ @     @                            @  ",
" @          @ @@@ @@@ @@@@@   @@@   @@@@@           @   ",
" @          @   @ @     @     @@@           @@@    @    ",
"  @        @   @   @    @      @            @@@   @     ",
"   @@    @@                   @             @@@  @      ",

"  @@@     @    @@@@@  @@@@@ @      @@@@@@@ @@@@@ @@@@@@@",
" @   @   @@   @     @@     @@    @ @      @     @@    @ ",
"@ @   @ @ @         @      @@    @ @      @          @  ",
"@  @  @   @    @@@@@  @@@@@ @@@@@@@ @@@@@ @@@@@@    @   ",
"@   @ @   @   @            @     @       @@     @  @    ",
" @   @    @   @      @     @     @ @     @@     @  @    ",
"  @@@   @@@@@ @@@@@@@ @@@@@      @  @@@@@  @@@@@   @    ",

" @@@@@  @@@@@    @     @@@      @           @     @@@@@ ",
"@     @@     @  @ @    @@@     @             @   @     @",
"@     @@     @   @            @     @@@@@     @        @",
" @@@@@  @@@@@@         @@@   @                 @     @@ ",
"@     @      @   @     @@@    @     @@@@@     @     @   ",
"@     @@     @  @ @     @      @             @          ",
" @@@@@  @@@@@    @     @        @           @       @   ",

" @@@@@    @   @@@@@@  @@@@@ @@@@@@ @@@@@@@@@@@@@@ @@@@@ ",
"@     @  @ @  @     @@     @@     @@      @      @     @",
"@ @@@ @ @   @ @     @@      @     @@      @      @      ",
"@ @ @ @@     @@@@@@@ @      @     @@@@@@  @@@@@  @  @@@@",
"@ @@@@ @@@@@@@@     @@      @     @@      @      @     @",
"@     @@     @@     @@     @@     @@      @      @     @",
" @@@@@ @     @@@@@@@  @@@@@ @@@@@@ @@@@@@@@       @@@@@ ",

"@     @  @*@        @@    @ @      @     @@     @@@@@@@@",
"@     @   @         @@   @  @      @@   @@@@    @@     @",
"@     @   @         @@  @   @      @ @ @ @@ @   @@     @",
"@@@@@@@   @         @@@@    @      @  @  @@  @  @@     @",
"@     @   @   @     @@  @   @      @     @@   @ @@     @",
"@     @   @   @     @@   @  @      @     @@    @@@     @",
"@     @  @@@   @@@@@ @    @ @@@@@@@@     @@     @@@@@@@@",

"@@@@@@  @@@@@ @@@@@@  @@@@@ @@@@@@@@     @@     @@     @",
"@     @@     @@     @@     @   @   @     @@     @@  @  @",
"@     @@     @@     @@         @   @     @@     @@  @  @",
"@@@@@@ @     @@@@@@@  @@@@@    @   @     @@     @@  @  @",
"@      @   @ @@   @        @   @   @     @ @   @ @  @  @",
"@      @    @ @    @ @     @   @   @     @  @ @  @  @  @",
"@       @@@@ @@     @ @@@@@    @    @@@@@    @    @@ @@ ",

"@     @@     @@@@@@@@ @@@@@ @       @@@@@    @          ",
" @   @  @   @      @  @      @          @   @ @         ",
"  @ @    @ @      @   @       @         @  @   @        ",
"   @      @      @    @        @        @               ",
"  @ @     @     @     @         @       @               ",
" @   @    @    @      @          @      @               ",
"@     @   @   @@@@@@@ @@@@@       @ @@@@@        @@@@@@@",

"  @@@                                                   ",
"  @@@     @@   @@@@@   @@@@  @@@@@  @@@@@@ @@@@@@  @@@@ ",
"   @     @  @  @    @ @    @ @    @ @      @      @    @",
"    @   @    @ @@@@@  @      @    @ @@@@@  @@@@@  @     ",
"        @@@@@@ @    @ @      @    @ @      @      @  @@@",
"        @    @ @    @ @    @ @    @ @      @      @    @",
"        @    @ @@@@@   @@@@  @@@@@  @@@@@@ @       @@@@ ",
 
"                                                        ",
" @    @    @        @ @    @ @      @    @ @    @  @@@@ ",
" @    @    @        @ @   @  @      @@  @@ @@   @ @    @",
" @@@@@@    @        @ @@@@   @      @ @@ @ @ @  @ @    @",
" @    @    @        @ @  @   @      @    @ @  @ @ @    @",
" @    @    @   @    @ @   @  @      @    @ @   @@ @    @",
" @    @    @    @@@@  @    @ @@@@@@ @    @ @    @  @@@@ ",
 
"                                                        ",
" @@@@@   @@@@  @@@@@   @@@@   @@@@@ @    @ @    @ @    @",
" @    @ @    @ @    @ @         @   @    @ @    @ @    @",
" @    @ @    @ @    @  @@@@     @   @    @ @    @ @    @",
" @@@@@  @  @ @ @@@@@       @    @   @    @ @    @ @ @@ @",
" @      @   @  @   @  @    @    @   @    @  @  @  @@  @@",
" @       @@@ @ @    @  @@@@     @    @@@@    @@   @    @",
 
"                       @@@     @     @@@   @@    @ @ @ @",
" @    @  @   @ @@@@@@ @        @        @ @  @  @ @ @ @ ",
"  @  @    @ @      @  @        @        @     @@ @ @ @ @",
"   @@      @      @  @@                 @@        @ @ @ ",
"   @@      @     @    @        @        @        @ @ @ @",
"  @  @     @    @     @        @        @         @ @ @ ",
" @    @    @   @@@@@@  @@@     @     @@@         @ @ @ @"};


main(argc,argv)
     int argc;
     char *argv[];
{
  int a,b,c,len,ind;
  char line[80];

  for(argv++;--argc;argv++){
    len=strlen(*argv);
    if(len>10)
      len=10;
    for(a=0;a<7;a++){
      for(b=0;b<len;b++){
        if((ind=(*argv)[b]-' ')<0)
          ind=0;
        for(c=0;c<7;c++){
          line[b*8+c] = glyphs[(ind/8*7)+a][(ind%8*7)+c];
        }
        line[b*8+7] = ' ';
      }
      for(b=len*8-1;b>=0;b--){
        if(line[b]!=' ')
          break;
        line[b]='\0';
      }
      puts(line);
    }
    puts("");
  }
}

-- 
Brian Wallis (brw@jim.odr.oz)		    O'Dowd Research P/L.
	(03) 562-0100 Fax: (03) 562-0616,
	Telex: Jacobs Radio (Bayswater) 152093