gspool_jobdel - delete a job
int gspool_jobdel(const int fd, const unsigned flags, const slotno_t slot)
The gspool_jobdel() function is used to delete a job, aborting it if it is currently printing.
fd is a file descriptor previously returned by gspool_open
flags is zero, or the logical OR of one or both of the following:
Ignore changes since the list was last read
Ignore ``not printed'' flag
slot is the slot number corresponding to the job as previously returned by gspool_joblist, or gspool_jobfindslot.
If the job has not been printed, and flags does not contain
GSPOOL_FLAG_FORCE
, then the job will not be deleted, but the error
GSPOOL_NOT_PRINTED
will be reported. You can tell whether the job
has been printed from the struct apispq
job structure returned by xb_jobread
or xb_jobfind. The field apispq_dflags
has the bit designated by
APISPQ_PRINTED
set if it has been printed.
The function returns 0 if successful otherwise one of the error codes listed in Chapter 3.
An example to delete all jobs:
int fd, ret, nj, i; slotno_t *slots;
fd = gspool_open("myhost", (char *) 0, 0); if (fd < 0) { /* error handling */ ... }
ret = gspool_joblist(fd, 0, &nj, &slots); if (ret < 0) { /* error handling */ ... }
for (i = 0; i < nj; i++) { ret = gspool_jobdel(fd, GSPOOL_FLAG_FORCE, slots[i]); if (ret < 0) { /* error handling */ ... } } gspool_close(fd);
gspool_joblist(3), gspool_jobread(3), gspool_jobdata(3), gspool_jobadd(3), gspool_jobfind(3), gspool_jobfindslot(3), gspool_jobupd(3), gspool_jobmon(3), gspool_jobpbrk(3).
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.
John M Collins, Xi Software Ltd.