=head1 NAME

gspool_jobupd - update the details of a job

=head1 SYNOPSIS

=for man
\&\fB#include <gspool.h>\fR
.PP

=for html
<STRONG>#include &lt;gspool.h&gt;</STRONG>
<br>

B<int gspool_jobupd(const int>
I<fd>B<, const unsigned>
I<flags>B<, const slotno_t>
I<slot>B<, struct apispq *>
I<jobd>B<)>

=head1 DESCRIPTION

The B<gspool_jobupd()> function is used to update the details of a job.

I<fd> is a file descriptor previously returned by B<gspool_open>

I<flags> is zero, or C<GSPOOL_FLAG_IGNORESEQ> to ignore changes since the list was last read.

I<slot> is the slot number corresponding to the job as previously
returned by B<gspool_joblist> or B<gspool_jobfindslot>.

I<jobd> is a descriptor containing the job descriptor as defined in
F<gspool.h>.

=for html
<p>The fields in <CODE>struct apispq</CODE> are defined in the
gspool_jobread(3) <a href="#Apispq_def">documentation</a>.</p>

=for man
The fields in \fBstruct apispq\fR are defined in the documentation for
\fIgspool_jobread\fR\|(3).

Note that we recommend that the whole structure be first read in with
B<gspool_jobread> or B<gspool_jobfind> and then required fields updaated; this
approach will cover any future extensions with additional fields.

=head1 RETURN VALUES

=for html
<P>The function returns 0 if successful otherwise one of the error codes
<A HREF="TxtAPI-3.html#Error_codes">listed in Chapter 3</A>.</P>

=for man
The function \fBgspool_jobupd()\fR returns 0 if successful, otherwise one
of the following codes:
.Ip "GSPOOL_BAD_PRIORITY" 8
The job's priority is outside the range for the user, or it cannot be
changed by the user.
.Ip "GSPOOL_INVALID_FD" 8
Invalid File descriptor
.Ip "GSPOOL_BADWRITE" 8
failure writing to the network
.Ip "GSPOOL_BADREAD" 8
failure reading from the network
.Ip "GSPOOL_NOPERM" 8
The user does not have permission
.Ip "GSPOOL_ZERO_CLASS" 8
A class code of zero is illegal
.Ip "GSPOOL_BAD_COPIES" 8
The copies field is outside the limit for the user
.Ip "GSPOOL_BAD_FORM" 8
The form type filed has been left empty
.Ip "GSPOOL_SEQUENCE" 8
Sequence error, slot may be out of date
.Ip "GSPOOL_UNKNOWN_JOB" 8
Job not found
.Ip "GSPOOL_INVALIDSLOT" 8
Invalid slot number

=head1 EXAMPLE

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

=head1 SEE ALSO

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

=head1 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.

=head1 AUTHOR

John M Collins, Xi Software Ltd.

=cut

## Local Variables:
## mode: nroff
## End:
