pioputattrs Subroutine

Purpose

Updates printer attribute values in a printer attribute database.

Library

libqb.a

Syntax

#include <piostruct.h> int pioputattrs (QueueName, QueueDeviceName, NumAttrElems, AttrElemTable) const char * QueueName, * QueueDeviceName; unsigned short NumAttrElems; struct pioattr * AttrElemTable;

Description

The pioputattrs subroutine can update with one call any number of attributes defined in a printer attribute database.

The combination of the QueueName and QueueDeviceName parameters identify a specific printer attribute database. The QueueName and QueueDeviceName parameters must be unique for a particular host.

Parameters

Item Description
QueueName Specifies the print-queue name. The print queue does not have to exist.
QueueDeviceName Specifies the queue device name for the print queue name specified by the QueueName parameter. The queue device does not have to exist.
NumAttrElems Specifies the number of attribute elements in the table specified by the AttrElemTable parameter.
AttrElemTable Points to a table of attribute element structures. Each structure element in the table specifies an attribute name, the type of value to be updated for the attribute, the value and length of the value, and a field for the return code of the update operation. The type of the value to be updated should be PA_AVALT. If a specified attribute is not valid, the specified value is put in the database. The format of each structure element is defined by the pioattr structure definition in the /usr/include/piostruct.h file.

Return Values

Item Description
NumAttrElems Specifies the number of attribute elements for which the pioputattrs subroutine has successfully updated the specified values in the database.
-1 Indicates that an error occurred.

Examples

/* Array of elements to be passed to 
pioputattrs() */
#define ATTR_ARRAY_NO (sizeof(attr_table)/sizeof(attr_table[0]))
   
struct pioattr attr_table[] = {
        {"_b", PA_AVALT, "2", 1, 0}, /* attribute record for   */
                                     /* _b (bottom margin)     */
        {"_i", PA_AVALT, "0", 1, 0}, /* attribute record for   */
                                     /* _i (left indentation)  */
        {"_t", PA_AVALT, "3", 1, 0}, /* attribute record for   */
                                     /* _t (top margin)        */
        {"sA", PA_AVALT, "CP851", 5, 0} /* attribute record    */
                                     /*for eS (country code)*/
}
   
...
const char                       *qnm = "ps";
const char                       *qdnm = "lp0";
int                              retno;
register const pioattr_t         *pap;
   
...
if((retno = pioputattrs(qnm,qdnm,ATTR_ARRAY_NO,attr_table)) ==-1)
        {(void) fprintf(stderr,"Fatal error in pioputattrs()\n");
...
}