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:

Type Field Description
jobno_t apispp_job Job number being printed
slotno_t apispp_jslot Slot number of job being printed
char apispp_state State of printer
char apispp_sflags Scheduler flags
unsigned char apispp_dflags Despooler flags
unsigned char apispp_netflags Network flags
unsigned short apispp_extrn External printer type 0=standard
classcode_t apispp_class Class code bits 1=A 2=B 4=C etc
int_pid_t apispp_pid Process id of despooler process
netid_t apispp_netid Host id of printer network byte order
slotno_t apispp_rslot Slot number on remote machine
unsigned long apispp_minsize Minimum size of acceptable job
unsigned long apispp_maxsize Maximum size of acceptable job
char [] apispp_dev Device name
char [] apispp_form Form type
char [] apispp_ptr Printer name
char [] apispp_feedback Feedback message
char [] apispp_comment Printer description

The following bits are set in the apispp_sflags field to indicate printer flags:

Bit (#define) Meaning
APISPP_INTER Had interrupt message, not yet acted on it.
APISPP_HEOJ Had halt at end of job

The following bits are set in the apispp_dflags field to indicate printer flags:

Bit (#define) Meaning
APISPP_HADAB Had "Abort" message
APISPP_REQALIGN Alignment required

The apispp_netflags field contains the following bits:

Bit (#define) Meaning
APISPP_LOCALONLY Printer is local only to host.
APISPP_LOCALHOST Printer uses network filter


RETURN VALUES

The function returns 0 if successful otherwise one of the error codes listed in Chapter 3.


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).


AUTHOR

John M Collins, Xi Software Ltd.