Poster of Linux kernelThe best gift for a Linux geek
gspool_jobdel

gspool_jobdel

Section: GNUspool Print Manager (3) Updated: 2009-05-30
Local index Up
 

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 gspool_jobdel() returns 0 if successful, otherwise one of the following codes:
GSPOOL_UNKNOWN_JOB
job not found
GSPOOL_INVALID_FD
Invalid File descriptor
GSPOOL_BADWRITE
failure writing to the network
GSPOOL_BADREAD
failure reading from the network
GSPOOL_NOPERM
The user does not have permission
GSPOOL_SEQUENCE
sequence error, slot may be out of date
GSPOOL_INVALIDSLOT
Invalid slot number
GSPOOL_NOT_PRINTED
the job has not been printed
 

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

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.


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUES
EXAMPLE
SEE ALSO
COPYRIGHT
AUTHOR

This document was created by man2html, using the manual pages.
Time: 21:47:33 GMT, April 16, 2011