SLGetPrinterList(3) Impressario SLGetPrinterList(3)NAME
SLGetPrinterList, SLGetPrinterInfo - get printer information
SYNOPSIS
#include <spool.h>
int SLGetPrinterList(SLPrinterStruct *printersp[],
int *num_printersp);
int SLGetPrinterInfo(const char *printer,
SLPrinterStruct **pinfo);
DESCRIPTIONSLGetPrinterList returns a list of the printers registered with the
default spooling system. printersp is set by the function to point to a
list of SLPrinterStruct structures. These structures contain detailed
information about each printer. num_printersp is set to the number of
printers in the list. The returned list of printers is sorted
alphabetically according to the local_name field. The sort is case
independent.
SLGetPrinterInfo returns information about a single printer. printer
specifies the name of the printer for which information is desired. If
printer is NULL, the default printer will be used. pinfo is set by the
function to point to a SLPrinterStruct structure containing the
information about the printer.
The SLPrinterStruct is defined as:
typedef struct _slPrinterStruct {
char *local_name; /* Local printer name */
char *formal_name; /* Formal printer name */
char *type; /* Printer type (eg. Color) */
char *dev; /* Port name (eg. /dev/plp) */
unsigned int is_def: 1; /* 1 == default printer */
unsigned int is_class: 1; /* 1 == printer is class */
unsigned int is_networked: 1; /* 1 == network printer */
unsigned int _padding: 29; /* Unused - for alignment */
char *remote_host; /* Remote machine name */
char *remote_name; /* Remote printer name */
char *network_type; /* Remote machine type */
} SLPrinterStruct;
RETURN VALUE
0 is returned if execution was successful. -1 is returned and SLerrno is
set if an execution error has occurred.
EXECUTION ERROR CODESSLGetPrinterList and SLGetPrinterInfo will fail under the following
circumstances.
Page 1
SLGetPrinterList(3) Impressario SLGetPrinterList(3)
SL_ERR_FIND_SPOOLER An error occurred while attempting to determine
the available printer spooling systems.
SL_ERR_NO_SPOOLERS There are no printer spooling systems available.
In addition, SLGetPrinterInfo will fail under the following conditions.
SL_ERR_NO_DEF_PRINTER There is no default printer registered with the
printer spooling system.
SL_ERR_BAD_PRINTER_NAME The printer name specified is either an empty
string (""), or a string consisting entirely of
whitespace.
SL_ERR_BAD_CLASS_MEMBER The specified printer class contains an invalid
printer.
WARNING
A pointer to printersp obtained by a previous call to SLGetPrinterList
will be invalid after subsequent calls to the function. The contents of
the printer list printersp must be copied to be preserved. Note that the
character string fields of the structure must be duplicated in any copy
operation since these pointers also become invalid. Similarly, the
contents of the structure pointed to by pinfo will not be preserved
across calls to SLGetPrinterInfo.
NOTES
The following notes refer to BSD and System V systems to indicate the use
of the BSD and System V printer spooling systems respectively. All
mention of "fields" refers to the fields of the SLPrinterStruct
structure.
1. On BSD systems it is assumed that the formal_name field is the last
printer name to appear in the /etc/printcap entry printer name list.
2. On any spooling system, if the formal_name cannot be determined it
will be set to the value of type.
3. On BSD systems the printer type (ty=) may not be specified in the
/etc/printcap file entry for the printer. In that case the type
field will be set to the string "Unknown".
4. If a printer is not physically connected to the user's workstation,
but is accessed over the network, the printer is called a networked
printer. If a printer is networked, the dev field will be set to a
NULL pointer.
5. If the printer is physically connected to the user's workstation, it
is called a local printer. If a printer is local, the remote_host,
remote_name, and network_type fields will be set to the NULL
pointer.
Page 2
SLGetPrinterList(3) Impressario SLGetPrinterList(3)
6. On BSD systems one physical printer can be referred to by many
names. Therefore, it is possible for more than one printer in the
printer list to be marked as the default printer (i.e. def = 1).
7. On System V systems the is_class field is set to 1 if the printer is
actually a printer class rather than an actual physical printer. On
BSD systems this field is always set to 0.
SEE ALSOSLGetDefPrinterName(3), SLPerror(3), libspool(3)
Page 3