gspool_jobupd - update the details of a job
int gspool_jobupd(const int fd, const unsigned flags, const slotno_t slot, struct apispq * jobd)
The gspool_jobupd() function is used to update the details of a job.
fd is a file descriptor previously returned by gspool_open
flags is zero, or GSPOOL_FLAG_IGNORESEQ
to ignore changes since the list was last read.
slot is the slot number corresponding to the job as previously returned by gspool_joblist or gspool_jobfindslot.
jobd is a descriptor containing the job descriptor as defined in gspool.h.
The fields in struct apispq
are defined in the
gspool_jobread(3) documentation.
Note that we recommend that the whole structure be first read in with gspool_jobread or gspool_jobfind and then required fields updaated; this approach will cover any future extensions with additional fields.
The function returns 0 if successful otherwise one of the error codes listed in Chapter 3.
An example to change the name of job "readme.txt" to "myfile"
int fd, ret, nj, i; struct apispq job; slotno_t *slots;
fd = gspool_open("myhost", (char *) 0, 0); if (fd < 0) { /* error handling */ ... }
/* make a list of jobs */
ret = gspool_joblist(fd, 0, &nj, &slots); if (ret < 0) { /* error handling */ ... }
for (i = 0; i < nj; i++) { ret = gspool_jobread(fd, 0, list[i], &job); if (ret < 0) continue;
if (strcmp(job.apispq_file, "readme.txt")) continue;
strcpy(job.apispq_file, "myfile"); ret = gspool_jobupd(fd, 0, list[i], &job); if (ret < 0) { /* error handling */ ... } break; } gspool_close(fd);
gspool_joblist(3)
,
gspool_jobread(3)
,
gspool_jobdata(3)
,
gspool_jobadd(3)
,
gspool_jobdel(3)
,
gspool_jobfind(3)
,
gspool_jobfindslot(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.