gspool_ptrupd(3) update the details of a printer

SYNOPSIS

#include <gspool.h>

int gspool_ptrupd(const int fd , const unsigned flags, const slotno_t slot, struct apispp *ptrd)

DESCRIPTION

The gspool_ptrupd() function is used to update the details of a printer.

fd is a file descriptor previously returned by gspool_open

flags is zero, or "GSPOOL_FLAG_IGNORESEQ" to ignore changes since the list was last read.

slot is the slot number corresponding to the printer as previously returned by gspool_ptrlist or gspool_ptrfindslot.

ptrd is a descriptor containing the printer descriptor as defined in gspool.h. The fields in struct apispptr are defined in the documentation for gspool_ptrread(3).

Note that we recommend that the whole structure be first read in with gspool_ptrread or gspool_ptrfind and then required fields updaated; this approach will cover any future extensions with additional fields.

Only changes to the name device, description, form type, local flag, the minimun and maximum job sizes, the network filter flag and the class code are accepted, and none at all if the printer is running.

RETURN VALUES

The function gspool_ptrupd() returns 0 if successful, otherwise one of the following codes:
GSPOOL_INVALID_FD
Invalid File descriptor
GSPOOL_BADWRITE
failure writing to the network
GSPOOL_BADREAD
failure reading from the network
GSPOOL_NOPERM
The user does not have permission
GSPOOL_ZERO_CLASS
A class code of zero is illegal
GSPOOL_BAD_FORM
Invalid form type
GSPOOL_SEQUENCE
Sequence error, slot may be out of date
GSPOOL_UNKNOWN_PTR
Printer not found
GSPOOL_INVALIDSLOT
Invalid slot number
GSPOOL_PTR_RUNNING
Printer is running

EXAMPLE

An example to change the form type on printer "hplj1".

 int fd, ret;
 struct apispptr ptr;
 slotno_t pslot;
 fd = gspool_open("myhost", (char *) 0, 0);
 if (fd < 0) { /* error handling */
     ...
 }
 /* Find printer */
 ret = gspool_ptrfind(fd, 0, "hplj1", servip, &pslot, &ptr);
 if (ret < 0)  { /* error handling */
     ...
 }
 strcpy(ptr.apispp_form, "a4.p10");
 ret = gspool_ptrupd(fd, 0, pslot, &ptr);
 if (ret < 0) { /* error handling */
     ...
 }
 gspool_close(fd);

COPYRIGHT

Copyright (c) 2009 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the extent permitted by law.

AUTHOR

John M Collins, Xi Software Ltd.