gspool_ptradd - add a new printer
int gspool_ptradd(const int fd, struct apispptr *ptrd)
The function gspool_ptradd() is used to create a printer.
fd is a file descriptor previously returned by gspool_open
ptrd is a struct apispptr
describing the details of the
printer. It is defined in the file gspool.h.
The fields in struct apispptr
are defined in the
gspool_ptrread(3) documentation.
Only values for the name, device, formtype, description, local flag, the minimun and maximum job sizes, the network filter flag and the class code are accepted. All other parameters are ignored. We suggest that you clear all fields to zero before starting. Future releases with additional fields will be guaranteed to default to the existing behaviour if the additional fields are set to zero.
Xt_ptradd returns zero if successful, otherwise an error code will be returned according to the reason for failure.
Error codes are listed in Chapter 3,
An example to add a printer called hplj1
on device /dev/tty12
with form type a4
int fd, ret; struct apispptr ptr;
fd = gspool_open("myhost", (char *) 0, 0); if (fd < 0) { /* error handling */ ... }
memset((void *) &ptr, '\0', sizeof(ptr)); ptr.apispp_class = 0xffffffff; ptr.apispp_minsize = ptr.apispp_maxsize = 0; strcpy(ptr.apispp_ptr, "hplj1"); strcpy(ptr.apispp_form, "a4"); strcpy(ptr.apispp_dev, "tty12"); strcpy(ptr.apispp_comment, "My new printer"); ret = gspool_ptradd(fd, &ptr); if (ret < 0) { /* error handling */ ... }
gspool_close(fd);
gspool_ptrread(3)
,
gspool_ptrdel(3)
,
gspool_ptrfind(3)
,
gspool_ptrfindslot(3)
,
gspool_ptrupd(3)
,
gspool_ptrmon(3)
,
gspool_ptrop(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.