gspool_ptrupd - update the details of a printer
int gspool_ptrupd(const int fd , const unsigned flags, const slotno_t slot, struct apispp *ptrd)
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
gspool_ptrread(3) documentation.
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.
The function returns 0 if successful otherwise one of the error codes listed in Chapter 3.
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);
gspool_ptrlist(3), gspool_ptrread(3), gspool_ptradd(3), gspool_ptrdel(3), gspool_ptrfind(3), gspool_ptrfindslot(3), gspool_ptrmon(3), gspool_ptrop(3).
John M Collins, Xi Software Ltd.