gspool_ptrdel(3)

NAME

gspool_ptrdel - delete a printer

SYNOPSIS

#include <gspool.h>

int gspool_ptrdel(const int fd, const unsigned flags, const slotno_t
slot)

DESCRIPTION

The function ggssppooooll__ppttrrddeell(()) is used to delete a printer.

fd is a file descriptor previously returned by gspool_open

flags is either zero, or "GSPOOL_FLAG_IGNORESEQ" to ignore changes since the list was last read.

slot is the slot number corresponding to the printer as previously returned by gspool_ptrlist, or gspool_ptrfindslot.

RETURN VALUES

The function gspool_ptrdel() returns 0 if successful, otherwise one of the following codes:

GSPOOL_INVALID_FD
Invalid File descriptor
GSPOOL_BADWRITE
failure writing to the network
GSPOOL_BADREAD
failure reading from the network
GSPOOL_SEQUENCE
Sequence error, slot may be out of date
GSPOOL_UNKNOWN_PTR
Printer not found
GSPOOL_INVALIDSLOT
Invalid slot number
GSPOOL_PTR_RUNNING
The printer is running.
GSPOOL_NOPERM
The user does not have permission to delete printers.

EXAMPLE

An example to delete all printers:
int fd, ret, np, i;
slotno_t *slots;
fd = gspool_open("myhost", (char *)0, 0);
if (fd < 0) { /* error handling */
...
}
ret = gspool_ptrlist(fd, GSPOOL_LOCALONLY, &np, &slots);
if (ret < 0) { /* error handling */
...
}
for (i = 0; i < np; i++) {
ret = gspool_ptrdel(fd, 0, slots[i]);
if (ret < 0) { /* error handling */
...
}
}
gspool_close(fd);

SEE ALSO

gspool_ptrlist(3), gspool_ptrread(3), gspool_ptradd(3), gspool_ptrfind(3), gspool_ptrfindslot(3), gspool_ptrupd(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.
Copyright © 2010-2025 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout