piocmdout Subroutine

Purpose

Outputs an attribute string for a printer formatter.

Library

None (linked with the pioformat formatter driver)

Syntax

#include <piostruct.h>

piocmdout (attrname, fileptr, passthru, NULL)
char * attrname;
FILE * fileptr;
int  passthru;

Description

The piocmdout subroutine retrieves the specified attribute string from the Printer Attribute database and outputs the string to standard output. In the course of retrieval, this subroutine also resolves any logic and any embedded references to other attribute strings or integers.

The fileptr and passthru parameters are used to pass data that the formatter does not need to scan (for example, graphics data) from the input data stream to standard output.

Parameters

Item Description
attrname Points to a two-character attribute name for a string. The attribute name must be defined in the database and can optionally have been defined to the piogetvals subroutine as a variable string. The attribute should not be one that has been defined to the piogetvals subroutine as an integer.
fileptr Specifies a file pointer for the input data stream. If the piocmdout routine is called from the lineout formatter routine, the fileptr value should be the fileptr passed to the lineout routine as a parameter. Otherwise, the fileptr value should be stdin. If the passthru parameter is 0, the fileptr parameter is ignored.
passthru Specifies the number of bytes to be passed to standard output unmodified from the input data stream specified by the fileptr parameter. This occurs when the %x escape sequence is found in the attribute string or in a string included by the attribute string. If no %x escape sequence is found, the specified number of bytes is read from the input data stream and discarded. If no bytes are to be passed through, the passthru parameter should be 0.
Note: The fourth parameter is reserved for future use. This parameter should be a NULL pointer.

Return Values

Upon successful completion, the piocmdout subroutine returns the length of the constructed string.

If the piocmdout subroutine detects an error, it issues an error message and terminates the print job.