NAME

gspool_jobdel - delete a job


SYNOPSIS

#include <gspool.h>

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


DESCRIPTION

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:

GSPOOL_FLAG_IGNORESEQ

Ignore changes since the list was last read

GSPOOL_FLAG_FORCE

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.


RETURN VALUES

The function returns 0 if successful otherwise one of the error codes listed in Chapter 3.


EXAMPLE

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);


SEE ALSO

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).


AUTHOR

John M Collins, Xi Software Ltd.