Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
     5         kx /*   B B A N  -  A Better Banner Program  -  Apr84 IBM-PC version   */
     5         kx /*  The vax version will not work directly on the PC, because the
     5         kx **  UNIX shell metacharacter interpretation caused strings like
     5         kx **  'one two three' to be passed as a single command line arg, while
     5         kx **  under DOS, it becomes three: "'one", "two", and "three'"
     5         kx **  So, we need a scheme for embedding spaces in arguments.
     5         kx **  One: choose some other character like underscore '_' and after
     5         kx **  command line argument passing, translate it into a space.
     5         kx **  Two: alter the program logic to treat single and double
     5         kx **  quotes as delimiters, and keep concatenating DOS-passed arguments
     5         kx **  until the closing delimiter is detected.
     5         kx **  Two is more elegant, but One is easier.
     5         kx */
     5         kx 
     5         kx #include <stdlib.h>
     5         kx #include <stdio.h>
     5         kx #include <string.h>
     5         kx 
     5         kx #if defined(__STDC__) || defined(__cplusplus)
     5         kx # define P_(s) s
     5         kx #else
     5         kx # define P_(s) ()
     5         kx #endif
     5         kx 
     5         kx 
     5         kx /* banner.c */
     5         kx extern int main P_((int argc, char **argv));
     5         kx static void doline P_((void));
     5         kx static int aqarg P_((void));
     5         kx static int redarg P_((void));
     5         kx static int gint P_((char **pp));
     5         kx 
     5         kx #undef P_
     5         kx 
     5         kx /*   table of character translation patterns   */
     5         kx char            ctbl[128][7] =
     5         kx {				/*  stolen from banner  */
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /*below 040*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000 },            /* */
     5         kx     { 034, 034, 034, 010, 0, 034, 034 },            /*!*/
     5         kx     { 0167, 0167, 042, 0, 0, 0, 0 },                /*"*/
     5         kx     { 024, 024, 0177, 024, 0177, 024, 024 },        /*#*/
     5         kx     { 076, 0111, 0110, 076, 011, 0111, 076 },       /*$*/
     5         kx     { 0161, 0122, 0164, 010, 027, 045, 0107 },      /*%*/
     5         kx     { 030, 044, 030, 070, 0105, 0102, 071 },        /*&*/
     5         kx     { 034, 034, 010, 020, 0, 0, 0 },                /*'*/
     5         kx     { 014, 020, 040, 040, 040, 020, 014 },          /*(*/
     5         kx     { 030, 4, 2, 2, 2, 4, 030 },                    /*)*/
     5         kx     { 0, 042, 024, 0177, 024, 042, 0 },             /***/
     5         kx     { 0, 010, 010, 076, 010, 010, 0 },              /*+*/
     5         kx     { 0, 0, 0, 034, 034, 010, 020 },                /*,*/
     5         kx     { 0, 0, 0, 076, 0, 0, 0 },                      /*-*/
     5         kx     { 0, 0, 0, 0, 034, 034, 034 },                  /*.*/
     5         kx     { 1, 2, 4, 010, 020, 040, 0100 },               /*SLASH*/
     5         kx     { 034, 042, 0101, 0101, 0101, 042, 034 },       /*0*/
     5         kx     { 010, 030, 050, 010, 010, 010, 076 },          /*1*/
     5         kx     { 076, 0101, 1, 076, 0100, 0100, 0177 },        /*2*/
     5         kx     { 076, 0101, 1, 076, 1, 0101, 076 },            /*3*/
     5         kx     { 0100, 0102, 0102, 0102, 0177, 2, 2 },         /*4*/
     5         kx     { 0177, 0100, 0100, 0176, 1, 0101, 076 },       /*5*/
     5         kx     { 076, 0101, 0100, 0176, 0101, 0101, 076 },     /*6*/
     5         kx     { 0177, 0102, 04, 010, 020, 020, 020 },         /*7*/
     5         kx     { 076, 0101, 0101, 076, 0101, 0101, 076 },      /*8*/
     5         kx     { 076, 0101, 0101, 077, 1, 0101, 076 },         /*9*/
     5         kx     { 010, 034, 010, 0, 010, 034, 010 },            /*:*/
     5         kx     { 034, 034, 0, 034, 034, 010, 020 },            /*;*/
     5         kx     { 020, 010, 4, 2, 4, 010, 020 },                /*<*/
     5         kx     { 0, 0, 076, 0, 076, 0, 0 },                    /*=*/
     5         kx     { 4, 010, 020, 040, 020, 010, 4 },              /*>*/
     5         kx     { 076, 0101, 1, 016, 010, 0, 010 },             /*?*/
     5         kx     { 076, 0101, 0135, 0135, 0136, 0100, 076 },     /*@*/
     5         kx     { 010, 024, 042, 0101, 0177, 0101, 0101 },      /*A*/
     5         kx     { 0176, 0101, 0101, 0176, 0101, 0101, 0176 },   /*B*/
     5         kx     { 076, 0101, 0100, 0100, 0100, 0101, 076 },     /*C*/
     5         kx     { 0176, 0101, 0101, 0101, 0101, 0101, 0176 },   /*D*/
     5         kx     { 0177, 0100, 0100, 0174, 0100, 0100, 0177 },   /*E*/
     5         kx     { 0177, 0100, 0100, 0174, 0100, 0100, 0100 },   /*F*/
     5         kx     { 076, 0101, 0100, 0117, 0101, 0101, 076 },     /*G*/
     5         kx     { 0101, 0101, 0101, 0177, 0101, 0101, 0101 },   /*H*/
     5         kx     { 034, 010, 010, 010, 010, 010, 034 },          /*I*/
     5         kx     { 1, 1, 1, 1, 0101, 0101, 076 },                /*J*/
     5         kx     { 0102, 0104, 0110, 0160, 0110, 0104, 0102 },   /*K*/
     5         kx     { 0100, 0100, 0100, 0100, 0100, 0100, 0177 },   /*L*/
     5         kx     { 0101, 0143, 0125, 0111, 0101, 0101, 0101 },   /*M*/
     5         kx     { 0101, 0141, 0121, 0111, 0105, 0103, 0101 },   /*N*/
     5         kx     { 0177, 0101, 0101, 0101, 0101, 0101, 0177 },   /*O*/
     5         kx     { 0176, 0101, 0101, 0176, 0100, 0100, 0100 },   /*P*/
     5         kx     { 076, 0101, 0101, 0101, 0105, 0102, 075 },     /*Q*/
     5         kx     { 0176, 0101, 0101, 0176, 0104, 0102, 0101 },   /*R*/
     5         kx     { 076, 0101, 0100, 076, 1, 0101, 076 },         /*S*/
     5         kx     { 0177, 010, 010, 010, 010, 010, 010 },         /*T*/
     5         kx     { 0101, 0101, 0101, 0101, 0101, 0101, 076 },    /*U*/
     5         kx     { 0101, 0101, 0101, 0101, 042, 024, 010 },      /*V*/
     5         kx     { 0101, 0111, 0111, 0111, 0111, 0111, 066 },    /*W*/
     5         kx     { 0101, 042, 024, 010, 024, 042, 0101 },        /*X*/
     5         kx     { 0101, 042, 024, 010, 010, 010, 010 },         /*Y*/
     5         kx     { 0177, 2, 4, 010, 020, 040, 0177 },            /*Z*/
     5         kx     { 076, 040, 040, 040, 040, 040, 076 },          /*[*/
     5         kx     { 0100, 040, 020, 010, 004, 002, 001 },         /*\*/
     5         kx     { 076, 2, 2, 2, 2, 2, 076 },                    /*]*/
     5         kx     { 010, 024, 042, 0, 0, 0, 0 },                  /*^*/
     5         kx     { 0, 000, 000, 000, 000, 000, 0177 },           /*_*/
     5         kx     { 034, 034, 010, 04, 0, 0, 0 },                 /*`*/
     5         kx     { 0, 014, 022, 041, 077, 041, 041 },            /*a*/
     5         kx     { 0, 076, 041, 076, 041, 041, 076 },            /*b*/
     5         kx     { 0, 036, 041, 040, 040, 041, 036 },            /*c*/
     5         kx     { 0, 076, 041, 041, 041, 041, 076 },            /*d*/
     5         kx     { 0, 077, 040, 076, 040, 040, 077 },            /*e*/
     5         kx     { 0, 077, 040, 076, 040, 040, 040 },            /*f*/
     5         kx     { 0, 036, 041, 040, 047, 041, 036 },            /*g*/
     5         kx     { 0, 041, 041, 077, 041, 041, 041 },            /*h*/
     5         kx     { 0, 004, 004, 004, 004, 004, 004 },            /*i*/
     5         kx     { 0, 001, 001, 001, 001, 041, 036 },            /*j*/
     5         kx     { 0, 041, 042, 074, 044, 042, 041 },            /*k*/
     5         kx     { 0, 040, 040, 040, 040, 040, 077 },            /*l*/
     5         kx     { 0, 041, 063, 055, 041, 041, 041 },            /*m*/
     5         kx     { 0, 041, 061, 051, 045, 043, 041 },            /*n*/
     5         kx     { 0, 036, 041, 041, 041, 041, 036 },            /*o*/
     5         kx     { 0, 076, 041, 041, 076, 040, 040 },            /*p*/
     5         kx     { 0, 036, 041, 041, 045, 042, 035 },            /*q*/
     5         kx     { 0, 076, 041, 041, 076, 042, 041 },            /*r*/
     5         kx     { 0, 036, 040, 036, 001, 041, 036 },            /*s*/
     5         kx     { 0, 037, 004, 004, 004, 004, 004 },            /*t*/
     5         kx     { 0, 041, 041, 041, 041, 041, 036 },            /*u*/
     5         kx     { 0, 041, 041, 041, 041, 022, 014 },            /*v*/
     5         kx     { 0, 041, 041, 041, 055, 063, 041 },            /*w*/
     5         kx     { 0, 041, 022, 014, 014, 022, 041 },            /*x*/
     5         kx     { 0, 021, 012, 004, 004, 004, 004 },            /*y*/
     5         kx     { 0, 077, 002, 004, 010, 020, 077 },            /*z*/
     5         kx     { 034, 040, 040, 0140, 040, 040, 034 },         /*{*/
     5         kx     { 010, 010, 010, 0, 010, 010, 010 },            /*|*/
     5         kx     { 034, 2, 2, 3, 2, 2, 034 },                    /*}*/
     5         kx     { 060, 0111, 06, 0, 0, 0, 0 },                  /*~*/
     5         kx     { 0, 000, 000, 000, 000, 000, 000   },          /*DEL*/
     5         kx };
     5         kx 
     5         kx /*   string sizes that fit selected printer widths:
     5         kx   flag/size/-w=> 72  80  81 120 132 158 174 217 225
     5         kx    -hj   8        9  10  10  15  16  19  21  27  28
     5         kx    -ho   9        8   8   9  13  14  17  19  24  25
     5         kx    -fj  15        4   5   5   8   8  10  11  14  15
     5         kx    -fo  16        4   5   5   7   8   9  10  13  14
     5         kx   note: -jn "lower case" is similar to -on "CAPS"
     5         kx */
     5         kx 
     5         kx /*   table of parameter default values   */
     5         kx int             dw = 80;	/*  page width, print positions  */
     5         kx int             di = 0;		/*  indent, print positions  */
     5         kx int             db = 0;		/*  print <pb> blank lines before arg  */
     5         kx  /*  negative numbers require use of col  */
     5         kx int             dnp = 0200;	/*  contrast: 0200 -> pos, 0 -> neg  */
     5         kx int             doj = 0;	/*  spacing: 0 -> open, 1 -> jammed  */
     5         kx int             dclr = 8;	/*  justification: 8 -> left,
     5         kx 			    1 -> center, 0 -> right  */
     5         kx int             dtv = 0;	/*  vert size: 0 -> normal, 7 -> double  */
     5         kx int             dfh = 0;	/*  hor size: 0 -> normal, 7 -> double  */
     5         kx int             dex = 1;	/*  echo: 1 -> expand, 0 -> copy thru  */
     5         kx int             dau = 1;	/*  mark case: 1 -> caps, 0 -> asis  */
     5         kx int             dkd = 0;	/*  mark string: 0 -> pmark, 1 -> self  */
     5         kx 
     5         kx char            dmark[31] = "";	/*  marking chars - used serially  */
     5         kx 
     5         kx /*   parameters to use for current line   */
     5         kx int             pw, pi, pb, pnp, poj, pclr, ptv, pfh, pex, pau, pkd;
     5         kx char           *pms, pmark[31];
     5         kx 
     5         kx /*   global variables   */
     5         kx char           *arg, ioarg1[121], ioarg2[121];	/*  arg pointer, input areas  */
     5         kx int             aargc;
     5         kx char          **aargv;
     5         kx int             vx, strl;
     5         kx char           *chp, *esp, *imk, *mkp, *chh, mk;
     5         kx 
     5         kx /*   e.g:	bban -nk " BBAN "
     5         kx BBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBB
     5         kx BANBBANBBA      BAN      ANBBAN BANBB NBBAN BANBBANBBA
     5         kx ANBBANBBAN BANBB NB ANBBA BBAN B NBBA  BANB ANBBANBBAN
     5         kx NBBANBBANB ANBBA BB NBBAN BAN BAN BAN B NBB NBBANBBANB
     5         kx BBANBBANBB      BBA      BAN BANBB NB AN BA BBANBBANBB
     5         kx BANBBANBBA BBANB AN BANBB NB       BB NBB N BANBBANBBA
     5         kx ANBBANBBAN BANBB NB ANBBA BB NBBAN BA BBAN  ANBBANBBAN
     5         kx NBBANBBANB      NBB      BBA BBANB AN BANBB NBBANBBANB
     5         kx BBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBB
     5         kx */
     5         kx 
     5         kx int
     5         kx main (int argc, char **argv)
     5         kx {
     5         kx     int             firstarg, i, ival, xvx, cwd;
     5         kx     char           *p, *q, ol[226], *ols;
     5         kx 
     5         kx     /*   check for proper usage   */
     5         kx     if (argc < 2)
     5         kx     {
     5         kx 	printf ("Usage: bban [-abcdefghijklmnopqrstuvwx] textarg [-] [...]\n");
     5         kx 	printf ("[-] interpolate from stdin into command line.\n");
     5         kx 	printf ("-w#   (Width) The page width is set to #.\n");
     5         kx 	printf ("-i#   (Indent) # extra blanks are left-inserted into each output line.\n");
     5         kx 	printf ("-b#   (Blank lines) # extra blank lines will be output before the text\n");
     5         kx 	printf ("-lrc  (Left, Right, Centered) ;justification of output\n");
     5         kx 	printf ("-jo   (Jammed,Open) -j) omit normal 1-space border on top & left\n");
     5         kx 	printf ("-tv   (Tall,Vertically normal)\n");
     5         kx 	printf ("-fh   (Fat,Horizontally normal) \n");
     5         kx 	printf ("-ms   (Mark string,Self) -m) next input arg. forms cyclic banner chars\n");
     5         kx 	printf ("	-s) each text argument character used in forming itself.\n");
     5         kx 	printf ("-kd   (marK,Default mark) use the text argument string to mark itself\n");
     5         kx 	printf ("-au   (Asis,Uppercase) affect marking characters from -s or -k\n");
     5         kx 	printf ("-pn   (Positive,Negative)\n");
     5         kx 	printf ("-ex   (Echo,eXpand)\n");
     5         kx 	printf ("-g    (Global) \n");
     5         kx 	printf ("-q    (Quit) \n");
     5         kx 	printf ("The default flag settings are: -lovhsupxw120i0b0\n");
     5         kx 	printf ("bban -jm # text (Gives results similar to the banner command)\n");
     5         kx 	printf ("bban -m \\ EST -b-8ils EST \n");
     5         kx 	printf ("bban -jmn NUTS <12 underscores> -tfow72 ____NUTS____ -w72 <12 more>'\n");
     5         kx 	printf ("bban -j LO VE | bban -j -\n");
     5         kx 	exit (1);
     5         kx     }
     5         kx     /*   make cmd line args available to other routines   */
     5         kx     aargc = argc;
     5         kx     aargv = argv;
     5         kx     /*   set parameters to default values   */
     5         kx     pw = dw;
     5         kx     pi = di;
     5         kx     pb = db;
     5         kx     pnp = dnp;
     5         kx     poj = doj;
     5         kx     pclr = dclr;
     5         kx     ptv = dtv;
     5         kx     pfh = dfh;
     5         kx     pex = dex;
     5         kx     pau = dau;
     5         kx     pkd = dkd;
     5         kx     pms = dmark;
     5         kx     imk = pms;
     5         kx 
     5         kx     /*   loop on args from cmd line or std input   */
     5         kx     firstarg = 1;
     5         kx 
     5         kx     while (aqarg () != 0)
     5         kx     {
     5         kx 	if (*arg == '-')
     5         kx 	{			/*  analyze flag args  */
     5         kx 	    p = arg;		/*  note q flag in loop condition  */
     5         kx 	    while (*++p != '\0' && *p != 'q' && *p != 'Q')
     5         kx 		switch (*p)
     5         kx 		{
     5         kx 		case 'w':
     5         kx 		case 'W':
     5         kx 		    if ((ival = gint (&p)) >= 1 && ival <= 225)
     5         kx 			pw = ival;
     5         kx 		    else
     5         kx 			printf ("W flag needs numeric 1:225, e.g: -w80\n");
     5         kx 		    break;
     5         kx 		case 'i':
     5         kx 		case 'I':
     5         kx 		    if ((ival = gint (&p)) >= 0)
     5         kx 			pi = ival;
     5         kx 		    else
     5         kx 			printf ("I flag needs numeric >= 0, e.g: -i0\n");
     5         kx 		    break;
     5         kx 		case 'b':
     5         kx 		case 'B':
     5         kx 		    pb = gint (&p);	/*  extra vertical spacing  */
     5         kx 		    break;
     5         kx 		case 'n':
     5         kx 		case 'N':
     5         kx 		    pnp = 0;	/*  contrast -> negative  */
     5         kx 		    break;
     5         kx 		case 'p':
     5         kx 		case 'P':
     5         kx 		    pnp = 0200;	/*  contrast -> positive  */
     5         kx 		    break;
     5         kx 		case 'o':
     5         kx 		case 'O':
     5         kx 		    poj = 0;	/*  spacing -> open  */
     5         kx 		    break;
     5         kx 		case 'j':
     5         kx 		case 'J':
     5         kx 		    poj = 1;	/*  spacing -> jammed  */
     5         kx 		    break;
     5         kx 		case 'c':
     5         kx 		case 'C':
     5         kx 		    pclr = 1;	/*  justification -> center  */
     5         kx 		    break;
     5         kx 		case 'l':
     5         kx 		case 'L':
     5         kx 		    pclr = 8;	/*  justification -> left  */
     5         kx 		    break;
     5         kx 		case 'r':
     5         kx 		case 'R':
     5         kx 		    pclr = 0;	/*  justification -> right  */
     5         kx 		    break;
     5         kx 		case 't':
     5         kx 		case 'T':
     5         kx 		    ptv = 7;	/*  height -> double  */
     5         kx 		    break;
     5         kx 		case 'v':
     5         kx 		case 'V':
     5         kx 		    ptv = 0;	/*  height -> normal  */
     5         kx 		    break;
     5         kx 		case 'f':
     5         kx 		case 'F':
     5         kx 		    pfh = 7;	/*  width -> double  */
     5         kx 		    break;
     5         kx 		case 'h':
     5         kx 		case 'H':
     5         kx 		    pfh = 0;	/*  width -> normal  */
     5         kx 		    break;
     5         kx 		case 'e':
     5         kx 		case 'E':
     5         kx 		    pex = 0;	/*  echo only - don't expand  */
     5         kx 		    break;
     5         kx 		case 'x':
     5         kx 		case 'X':
     5         kx 		    pex = 1;	/*  expand to banner size  */
     5         kx 		    break;
     5         kx 		case 'g':
     5         kx 		case 'G':
     5         kx 		    firstarg = 1;	/*  reset global defaults  */
     5         kx 		    break;
     5         kx 		case 'a':
     5         kx 		case 'A':
     5         kx 		    pau = 0;	/*  use chars asis for mark  */
     5         kx 		    break;
     5         kx 		case 'u':
     5         kx 		case 'U':
     5         kx 		    pau = 1;	/*  use upper case for mark  */
     5         kx 		    break;
     5         kx 		case 'k':
     5         kx 		case 'K':
     5         kx 		    pkd = 1;	/*  use string to mark itself  */
     5         kx 		    break;
     5         kx 		case 'd':
     5         kx 		case 'D':
     5         kx 		    pkd = 0;	/*  revert to default mark string  */
     5         kx 		    break;
     5         kx 		case 's':
     5         kx 		case 'S':
     5         kx 		    pmark[0] = '\0';	/*  mark with self  */
     5         kx 		    pms = pmark;
     5         kx 		    pkd = 0;
     5         kx 		    break;
     5         kx 		case 'm':
     5         kx 		case 'M':
     5         kx 		    if (aqarg () == 0)
     5         kx 		    {
     5         kx 			printf ("M flag needs mark string, e.g: -m ABC\n");
     5         kx 			break;
     5         kx 		    }
     5         kx 		    for (i = 0; i < 30; i++)
     5         kx 		    {
     5         kx 			if (*arg == '\0')
     5         kx 			    break;
     5         kx 			if ((pmark[i] = *arg++) <= 040 ||
     5         kx 			    pmark[i] == 0177)
     5         kx 			    i--;
     5         kx 		    }
     5         kx 		    pmark[i] = '\0';
     5         kx 		    pms = pmark;
     5         kx 		    imk = pms;
     5         kx 		    pkd = 0;
     5         kx 		    break;
     5         kx 		default:	/*  there ain't many left!  */
     5         kx 		    printf ("Illegal flag \"%c\", ignored\n", *p);
     5         kx 		}		/*endswitch*/
     5         kx 
     5         kx 	    if (firstarg)
     5         kx 	    {			/*  reset defaults to first flag arg  */
     5         kx 		dw = pw;
     5         kx 		di = pi;
     5         kx 		db = pb;
     5         kx 		dnp = pnp;
     5         kx 		doj = poj;
     5         kx 		dclr = pclr;
     5         kx 		dtv = ptv;
     5         kx 		dfh = pfh;
     5         kx 		dex = pex;
     5         kx 		dau = pau;
     5         kx 		dkd = pkd;
     5         kx 		p = dmark;
     5         kx 		q = pmark;
     5         kx 		while ((*p++ = *q++) != '\0')
     5         kx 		    ;
     5         kx 		pms = dmark;
     5         kx 	    }
     5         kx 	}
     5         kx 	else
     5         kx 	{			/*  non-flag argument - print it  */
     5         kx 	    /*   determine string length and page positioning   */
     5         kx 	    cwd = (pex) ? 9 + pfh - poj : 1;
     5         kx 	    if (pw - pi < cwd)
     5         kx 	    {
     5         kx 		printf ("-i%d and -w%d allow inadequate space\n", pi, pw);
     5         kx 		continue;
     5         kx 	    }
     5         kx 
     5         kx 	    for (i = 0; i < pb; i++)
     5         kx 		printf ("\n");
     5         kx 
     5         kx 	    for (i = 0; i > pb; i--)
     5         kx 		printf ("7");	/*  esc-7  */
     5         kx 
     5         kx 	    for (strl = 0; arg[strl]; strl++)
     5         kx 		;
     5         kx 
     5         kx 	    if (strl * cwd > pw - pi)
     5         kx 		strl = (pw - pi) / cwd;
     5         kx 
     5         kx 	    ols = ol + pi + ((pw - pi - strl * cwd) >> pclr);
     5         kx 
     5         kx 	    for (p = ol; p < ols; p++)
     5         kx 		*p = ' ';	/*  blank l.h. margin  */
     5         kx 
     5         kx 	    if (pex)
     5         kx 	    {			/*  expand chars to banner size  */
     5         kx 		if (pkd)
     5         kx 		{		/*  mark w/string itself  */
     5         kx 		    p = arg;
     5         kx 		    for (i = 0; i < 30; i++)
     5         kx 		    {
     5         kx 			if (*p == '\0')
     5         kx 			    break;
     5         kx 
     5         kx 			/* patch to interpret underscores as spaces */
     5         kx 			if (*p == '_')
     5         kx 			    *p = ' ';
     5         kx 
     5         kx 			pmark[i] = *p++;
     5         kx 			if (pmark[i] <= 040 || pmark[i] == 0177)
     5         kx 			    i--;
     5         kx 			else if (pau && pmark[i] >= 'a' && pmark[i]
     5         kx 				 <= 'z')
     5         kx 			    pmark[i] -= ('a' - 'A');
     5         kx 		    }
     5         kx 		    pmark[i] = '\0';
     5         kx 		    pms = pmark;
     5         kx 		    imk = pms;
     5         kx 		}
     5         kx 		/*   loop for each horizontal slice of chars   */
     5         kx 		for (vx = poj; vx <= 8; vx++)
     5         kx 		{
     5         kx 		    for (xvx = 0; xvx <= ((vx & ptv) != 0); xvx++)
     5         kx 		    {
     5         kx 			esp = ol;	/*  loc of newline  */
     5         kx 			chp = ols;	/*  start of 1st char  */
     5         kx 			doline ();	/*  format one line  */
     5         kx 			*esp = '\0';
     5         kx 			printf ("%s\n", ol);	/*  VOLA!!  */
     5         kx 			*esp = ' ';
     5         kx 			if (*imk == '\0' || *++imk == '\0')
     5         kx 			    imk = pms;
     5         kx 		    }
     5         kx 		}
     5         kx 	    }
     5         kx 	    else
     5         kx 	    {			/*  echo without expansion  */
     5         kx 		esp = ol;
     5         kx 		chp = ols;
     5         kx 		for (i = 0; i < strl; i++)
     5         kx 		{
     5         kx 		    *chp = arg[i];
     5         kx 		    if (*chp++ != ' ')
     5         kx 			esp = chp;
     5         kx 		}
     5         kx 		*esp = '\0';
     5         kx 		printf ("%s\n", ol);
     5         kx 	    }
     5         kx 	    /*   reset parms to defaults   */
     5         kx 	    pw = dw;
     5         kx 	    pi = di;
     5         kx 	    pb = db;
     5         kx 	    pnp = dnp;
     5         kx 	    poj = doj;
     5         kx 	    pclr = dclr;
     5         kx 	    ptv = dtv;
     5         kx 	    pfh = dfh;
     5         kx 	    pex = dex;
     5         kx 	    pau = dau;
     5         kx 	    pkd = dkd;
     5         kx 	    if (pms != dmark)
     5         kx 	    {
     5         kx 		pms = dmark;
     5         kx 		imk = pms;
     5         kx 	    }
     5         kx 	}
     5         kx 	firstarg = 0;
     5         kx     }
     5         kx     for (i = 0; i < pb; i++)
     5         kx 	printf ("\n");
     5         kx 
     5         kx     return (0);
     5         kx }
     5         kx 
     5         kx static void
     5         kx doline (void)
     5         kx {
     5         kx     int             cx, hx, xhx, chs;
     5         kx     mkp = imk;
     5         kx     for (cx = 0; cx < strl; cx++)
     5         kx     {				/*  loop on chars  */
     5         kx 	chh = arg + cx;
     5         kx 
     5         kx 	/* patch to convert underscores to spaces */
     5         kx 	if (*chh == '_')
     5         kx 	    *chh = ' ';
     5         kx 
     5         kx 	chs = (vx & 7) ? ctbl[(*chh)&0x7F][vx - 1] : 0;
     5         kx 	/*   convert mark to upper case   */
     5         kx 	mk = (pau && *chh >= 'a' && *chh <= 'z') ? *chh - ('a' - 'A') : *chh;
     5         kx 	for (hx = poj; hx <= 8; hx++)
     5         kx 	{			/*  vert slice  */
     5         kx 	    for (xhx = 0; xhx <= ((hx & pfh) != 0); xhx++)
     5         kx 	    {
     5         kx 		if (*pms)
     5         kx 		{		/*  cycle mark string  */
     5         kx 		    mk = *mkp;
     5         kx 		    if (*++mkp == '\0')
     5         kx 			mkp = pms;
     5         kx 		}
     5         kx 		*chp = ((chs << hx & 0200) == pnp) ? mk : ' ';
     5         kx 		if (*chp++ != ' ')
     5         kx 		    esp = chp;
     5         kx 	    }
     5         kx 	}
     5         kx     }
     5         kx }
     5         kx 
     5         kx static int
     5         kx aqarg (void)
     5         kx {
     5         kx     static int      dashsw = 0;
     5         kx     if (--aargc > 0)
     5         kx     {				/*  more cmd line args  */
     5         kx 	if (**++aargv != '-' || *(*aargv + 1) != '\0')
     5         kx 	{
     5         kx 	    arg = *aargv;
     5         kx 	    dashsw = 0;
     5         kx 	    return 1;
     5         kx 	}
     5         kx 	else
     5         kx 	{			/*  lone dash - std input  */
     5         kx 	    dashsw = 1;
     5         kx 	    if (redarg ())
     5         kx 		return 1;
     5         kx 	    printf ("EOF on std input\n");
     5         kx 	    return 0;
     5         kx 	}
     5         kx     }
     5         kx     else
     5         kx     {				/*  read input if dash last  */
     5         kx 	if (dashsw)
     5         kx 	    return (redarg ());
     5         kx 	arg = ioarg1;
     5         kx 	ioarg1[0] = '\0';
     5         kx 	return 0;
     5         kx     }
     5         kx }
     5         kx 
     5         kx static int
     5         kx redarg (void)
     5         kx {
     5         kx     static int      c = 1, bufsw = 1;
     5         kx     register int    i;
     5         kx 
     5         kx     arg = (bufsw ^= 1) ? ioarg1 : ioarg2;
     5         kx     arg[0] = '\0';
     5         kx 
     5         kx     if (c == EOF)
     5         kx 	return 0;
     5         kx 
     5         kx     for (i = 0; i < 120; i++)
     5         kx     {
     5         kx 	arg[i] = (c = getchar ());
     5         kx 	if (c == '\n' || c == EOF)
     5         kx 	    break;
     5         kx     }
     5         kx 
     5         kx     arg[i] = '\0';
     5         kx 
     5         kx     if (c == EOF)
     5         kx 	return 0;
     5         kx 
     5         kx     if (c == '\n')
     5         kx 	return 1;
     5         kx 
     5         kx     while ((c = getchar ()) != '\n' && c != EOF)
     5         kx 	;
     5         kx 
     5         kx     return 1;
     5         kx }
     5         kx 
     5         kx static int
     5         kx gint (char **pp)
     5         kx {
     5         kx     int             dsw = 0, rslt = 0;
     5         kx 
     5         kx     if (*(*pp + 1) == '-')
     5         kx     {
     5         kx 	dsw = 1;
     5         kx 	(*pp)++;
     5         kx     }
     5         kx 
     5         kx     while (*(*pp + 1) >= '0' && *(*pp + 1) <= '9')
     5         kx     {
     5         kx 	(*pp)++;
     5         kx 	rslt = 10 * rslt + **pp - '0';
     5         kx     }
     5         kx 
     5         kx     if (dsw)
     5         kx 	return -rslt;
     5         kx 
     5         kx     return rslt;
     5         kx }