gspool_ptrread(3)

NAME
gspool_ptrread - get the details of a printer

SYNOPSIS
#include <gspool.h>

int gspool_ptrread(const int fd, const unsigned flags, const slotno_t slot, struct apispptr *ptrd)

DESCRIPTION
The gspool_ptrread() function is used to retrieve the details of a printer from a given slot number.

fd is a file descriptor previously returned by gspool_open

flags is zero, or a logical OR of one of the following values

GSPOOL_FLAG_LOCALONLY
    Ignore remote printers/hosts, i.e. not local to the server, not the client.

GSPOOL_FLAG_USERONLY
    Ignore other users jobs

GSPOOL_FLAG_IGNORESEQ
    Ignore changes since the list was last read

slot is the slot number corresponding to the printer as previouly returned by a call to gspool_ptrlist() or gspool_ptrfindslot().

ptrd is a descriptor, which on return will contain the details of the printer in a "struct apispptr" as defined in gspool.h and containing the following elements: Job number being printed Slot number of job being printed State of printer Scheduler flags Despooler flags Network flags External printer type 0=standard Class code bits 1=A 2=B 4=C etc Process id of despooler process Host id of printer network byte order Slot number on remote machine Minimum size of acceptable job Maximum size of acceptable job Device name Form type Printer name Feedback message Printer description

The following bits are set in the "apispp_sflags" field to indicate printer flags: Had interrupt message, not yet acted on it. Had halt at end of job

The following bits are set in the "apispp_dflags" field to indicate printer flags: Had "Abort" message Alignment required

The "apispp_netflags" field contains the following bits: Printer is local only to host. Printer uses network filter

RETURN VALUES
The function gspool_ptrread() returns 0 if successful, otherwise one of the following codes: Printer not found Invalid File descriptor failure writing to the network failure reading from the network The user does not have permission Printer sequence error, slot may be out of date Invalid slot number

EXAMPLE
An example to read the names of all printers

 int fd, ret, np, i;
 struct apispptr ptr;
 slotno_t *slots;

 fd = gspool_open("myhost", (char *)0, 0);
 if (fd < 0) {  /* error handling */
     ...
 }

 ret = gspool_ptrlist(fd, 0, &np, &slots);
 if (ret < 0) { /* error handling */
     ...
 }

 for (i = 0; i < np, i++) {
     ret = gspool_ptrread(fd, GSPOOL_FLAG_IGNORESEQ, slots[i], &ptr);
     if (ret < 0)       { /* error handling */
         ...
     }
     printf("%s\n", ptr.apispp_ptr);
 }
 gspool_close(fd);

SEE ALSO
gspool_ptrlist(3), gspool_ptradd(3), gspool_ptrdel(3), gspool_ptrupd(3), gspool_ptrfind(3), gspool_ptrfindslot(3), gspool_ptrmon(3), gspool_ptrop(3).

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.