SYNOPSIS
#include <gspool.h>int gspool_putspu(const int fd, struct apispdr *ret)
DESCRIPTION
The gspool_putspd() function is used to set the default user privileges on the local host.Its parameters are as follows:
fd is a file descriptor previously returned by gspool_open
res points to a structure which contains the privileges. The "struct apisphdr" is defined in the file gspool.h.
RETURN VALUES
- GSPOOL_UNKNOWN_USER
- Invalid user name
- 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_ZERO_CLASS
- A class code of zero is illegal
- GSPOOL_BAD_PRIORITY
- One of the priority fields contains zero
- GSPOOL_BAD_COPIES
- The copies field contains zero
- GSPOOL_BAD_FORM
- The form type filed has been left empty
EXAMPLE
An example to give all users the permission to add and delete printers:
int fd, ret; struct apisphdr new_privs; fd = gspool_open("myhost", (char *)0, 0); if (fd < 0) { /* error handling */ ... } /* get the current permissions */ ret = gspool_getspd(fd, &new_privs); if (ret < 0) { /* error handling */ ... } if (!(new_privs.sph_flgs & PV_ADDDEL)) new_privs.sph_flgs |= PV_ADDDEL; ret = gspool_putspd(fd, &new_privs); if (ret < 0) { /* error handling */ ... } gspool_close(fd);
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.