=head1 NAME

gspool_putspu - set default permissions for a user

=head1 SYNOPSIS

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

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

B<int gspool_putspu(const int> I<fd>B<, const char *>I<user>B<, struct apispdet *>I<newp>B<)>

=head1 DESCRIPTION

The B<gspool_putspu()> function is used to set privileges for a user.

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

I<user> is a pointer to the user name, for which the details are being updated.

I<newp> is a pointer to a structure containing the new user
privileges.

The C<struct apispdet> is defined int the file F<gspool.h>.

=for html
<p>The fields of the structure are <a href="#Apispdet_def">as defined</a>
for <strong>gspool_getspu</strong>.</p>

=head1 RETURN VALUES

The function B<gspool_putspu()> returns 0 if successful otherwise one of the following:

=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
.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_UNKNOWN_USER" 8
Invalid user name
.IP "GSPOOL_NOPERM" 8
The user does not have permission
.IP "GSPOOL_ZERO_CLASS" 8
class code of zero is illegal
.IP "GSPOOL_BAD_PRIORITY" 8
One of the priority fields contains zero
.IP "GSPOOL_BAD_COPIES" 8
The copies field contains zero
.IP "GSPOOL_BAD_FORM" 8
The form type filed has been left empty

=head1 EXAMPLE

An example to give a user permission to add and delete printers

 int fd, ret;
 struct apispdet new_privs;

 fd = gspool_open("myhost", (char *)0, 0);
 if (fd < 0) { /* error handling */
     ...
 }

 ret = gspool_getspu(fd, "helen", &new_privs);
 if (ret < 0)	{ /* error handling */
     ...
 }

 if (!(new_privs.spu_flgs & PV_ADDDEL))
     new_privs.spu_flgs |= PV_ADDDEL;

 gspool_close(fd);

=head1 SEE ALSO

gspool_getspu(3),
gspool_getspd(3),
gspool_putspd(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:
