setup Subroutine

Purpose

Performs setup processing for the print formatter.

Library

None (provided by the formatter).

Syntax

#include <piostruct.h> struct shar_vars *setup (argc, argv, passthru) unsigned  argc; char * argv [ ]; int  passthru;

Description

The setup subroutine performs the following tasks:

The setup subroutine should not send commands or data to the printer since the formatter driver performs additional error checking when the setup subroutine returns.

Parameters

Item Description
argc Specifies the number of formatting arguments from the command line (including the command name).
argv Points to a list of pointers to the formatting arguments.
passthru Indicates whether the input data stream should be formatted (the passthru value is 0) or passed through without modification (the passthru value is1). The value for this parameter is the argument value for the -# flag specified to the pioformat formatter driver. If the -# flag is not specified, the passthru value is 0.

Return Values

Upon successful completion, the setup subroutine returns one of the following pointers:

Returning a pointer to a shar_vars structure causes the formatter driver to invoke the formatter's lineout function for each line to be printed. Returning a null pointer causes the formatter driver to invoke the formatter's passthru function once instead.

If the setup subroutine detects an error, it uses the piomsgout subroutine to issue an error message. The setup subroutine then invokes the pioexit subroutine with a value of PIOEXITBAD. Note that if the piogetvals, piogetopt, piocmdout, or piogetstr subroutine detects an error, it automatically issues its own error message and terminates the print job.