User`s guide
4-26
Guide to Printers and Printing
/* TABLE OF ATTRIBUTE VALUES */
struct attrparms attrtable[] = { /*
name data type lookup address of pointer */
”_b”, VAR_INT, NULL, (union dtypes *) &_Bmarg,
”_g”, VAR_INT, NULL, (union dtypes *) &_Beginpg,
”_i”, VAR_INT, NULL, (union dtypes *) &_Indent,
”_j”, VAR_INT, NULL, (union dtypes *) &_Init_printer,
”_l”, VAR_INT, NULL, (union dtypes *) &_Pglen,
”_t”, VAR_INT, NULL, (union dtypes *) &_Tmarg,
”_w”, VAR_INT, NULL, (union dtypes *) &_Pgwidth,
”_J”, VAR_INT, NULL, (union dtypes *) &_Restoreprinter,
”_Z”, VAR_INT, NULL, (union dtypes *) &_Do_formfeed,
”wp”, VAR_INT, NULL, (union dtypes *) &_Passthru,
”wf”, VAR_STR, NULL, (union dtypes *) &_Ff_cmd,
”wi”, VAR_STR, NULL, (union dtypes *) &_Vincr_cmd,
”wy”, VAR_STR, NULL, (union dtypes *) &_Vdecr_cmd,
”wV”, VAR_INT, NULL, (union dtypes *) &_Vincr,
”wD”, VAR_INT, NULL, (union dtypes *) &_Vdecr,
NULL, 0 , NULL, NULL };
int pglen, tmarg, bmarg, vpos, vtab_base;
struct shar_vars sharevars;
struct shar_vars * /*** Setup Processing ***/
setup(argc, argv, passthru)
unsigned argc;
char *argv[];
int passthru:
{
/* Initialize variables and command line values */
(void) piogetvals(attrtable, NULL);
(void) piogetopt(argc, argv, NULL, NULL);
/* (need to verify values entered by user) */
/* Initialize work variables */
pglen = Pglen * Vincr;
tmarg = Tmarg * Vincr;
bmarg = Bmarg * Vincr;
piopgskip = Beginpg – 1;
/* Check for pass–through option */
if (Passthru = passthru)
return(NULL);
/* Initialize pointers to vertical spacing */
/* variables shared with formatter driver */
/* (Refer to /usr/include/piostruct.h) */
sharevars._pl = &pglen;
sharevars._tmarg = &tmarg;
sharevars._bmarg = &bmarg;
sharevars._vpos = &vpos;
sharevars._vtab_base = &vtab_base;
sharevars._vincr = &Vincr;
sharevars._vincr_cmd = (&Vincr_cmd)–>ptr;
sharevars._vdecr = &Vdecr;
sharevars._vdecr_cmd = (&Vdecr_cmd)–>ptr;
sharevars._ff_cmd = (&Ff_cmd)–>ptr;
sharevars._ff_at_eof = &Do_formfeed;
return(&sharevars);
}
initialize() /*** Initialize the Printer ***/
{
if (Init_printer)
(void) piocmdout(INIT_CMD, NULL, 0, NULL);
return(0);
}