gspool_ptrfind(3) get the details of a printer from printer name

SYNOPSIS

#include <gspool.h>

int gspool_ptrfind(const int fd, const unsigned flags, const char *name, const netid_t nid, slotno_t *slot, struct apispptr *ptrd)

int gspool_ptrfindslot(const int fd, const unsigned flags, const char *name, const netid_t nid, slotno_t *slot)

DESCRIPTION

The gspool_ptrfind() and gspool_ptrfindslot functions may be used to find a printer from a given printer name rather than by the slot number. gspool_ptrfind retrieves the printer description, gspool_ptrfindslot just retrieves the slot number.

fd is a file descriptor previously returned by gspool_open

flags is zero, or "GSPOOL_FLAG_LOCALONLY" to ignore remote printers/hosts, i.e. not local to the server, not the client.

name is the printer name to be searched for.

nid is the network-byte order IP address of the host of the machine whose printer is to be searched for. This should be correct even if "GSPOOL_FLAG_LOCALONLY" is specified.

slot is a pointer to a location in which the slot number of the printer is placed if the search is successfull. It may be "NULL" if this is not required (but this would be almost pointless for gspool_ptrfindslot).

ptrd is a pointer to a field to contain the printer name as defined in gspool.h. The fields in struct apispptr are defined in the documentation for gspool_ptrread(3).

NOTES

If two or more printers on the same host have the same name, then it is not defined which is returned by gspool_ptrfind and gspool_ptrfindslot. In such cases, the whole printer list should be read and the correct one selected.

RETURN VALUES

The functions gspool_ptrfind() and gspool_ptrfindslot return 0 if successful, otherwise one of the following codes:
GSPOOL_UNKNOWN_PTR
Printer not found
GSPOOL_INVALID_FD
Invalid File descriptor
GSPOOL_BADWRITE
failure writing to the network
GSPOOL_BADREAD
failure reading from the network

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.