PRINTERDB(3) — UNIX Programmer’s Manual
NAME
prdb_set, prdb_get, prdb_getbyname, prdb_end − get printer database entry
SYNOPSIS
#include <printerdb.h>
void prdb_set(char ∗domain);
prdb_ent ∗prdb_get(void);
prdb_ent ∗prdb_getbyname(const char ∗name);
void prdb_end(void);
DESCRIPTION
These routines retrieve information from the printer entry database. prdb_getbyname is useful for looking up a single printer entry. The other routines are used for getting all of the printer entries. prdb_set initializes the library to point to the beginning of the printer entry list. prdb_get returns the next printer entry, or NULL for end of list. prdb_end is called to free up any resources that may have been allocated during lookups. The following example illustrates how these latter three routines are typically used:
prdb_ent ∗prdb;
prdb_set(NULL);
while (prdb = prdb_get()) {
handle(prdb);
}
prdb_end();
The structure returned by prdb_getbyname and prdb_get is defined as follows:
typedef struct prdb_property {
char ∗pp_key;
char ∗pp_value;
} prdb_property;
typedef struct prdb_ent {
char ∗∗pe_name;
unsigned pe_nprops;
prdb_property ∗pe_prop;
} prdb_ent;
pe_name the name of the printer entry. pe_nprops is the number of members of this printer entry. pe_props is an array of prdb_property structures, which each contain the name and value for various properties of the printer. See printcap(5) for a description of these values.
A call to any of the printerdb(3) routines invalidates the information returned from a previous call.
SEE ALSO
BUGS
The domain argument to prdb_set() is ignored. It should always be set to NULL for compatibility with future releases.
7th Edition — June 21, 1989