Specifications
4-28
Guide to Printers and Printing
lineout(fileptr) /*** Format a Line ***/
FILE *fileptr;
{
int ch, charcount = 0;
for (ch = 0; ch < Indent; ch++)
pioputchar(’ ’);
while ((ch=piogetc(fileptr)) != ’\n’ && ch != EOF
&& charcount < Pgwidth) {
charcount++;
pioputchar(c);
}
vpos += Vincr;
return(charcount);
}
passthru() /*** Pass–through Option ***/
{
int ch;
while ((ch = piogetc(stdin)) != EOF)
pioputchar(ch);
if (piodatasent && Do_formfeed)
(void) piocmdout(FF_CMD, NULL, 0, NULL);
return(0);
}
restore() /*** Restore the Printer ***/
{
if (Restoreprinter)
(void) piocmdout(REST_CMD, NULL, 0, NULL);
return(0);
}
Compile and Link the Print Formatter
Use an editor to create an imports file named sample.imp. The file should contain the
following:
#!
main
piogetvals
piogetopt
piomsgout
pioexit
piomode
piodatasent
piopgskip
statusfile
piocmdout
piogetstr
Use an editor to create an exports file named sample.exp. The file should contain the
following:
#!
setup
initialize
passthru
restore
lineout
Enter the following to compile and link the formatter:
cc –o sample –bI:sample.imp –bE:sample.exp sample.c