gspool_ptrop - perform an operation on a printer

# NAME

gspool_ptrop - perform an operation on a printer

# SYNOPSIS

#include <gspool.h>

int gspool_ptrop(const int fd, const unsigned flags, const slotno_t slot, const unsigned op)

# DESCRIPTION

The gspool_ptrop() function is used to perform an operation on a printer.

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 printer as previously returned by a call to gspool_ptrlist() or gspool_ptrfindslot.

op is one of the following values:

Operation code | Description
--- | ---
PRINOP_RSP | Restart printer
PRINOP_PHLT | Halt printer at the end of the current job
PRINOP_PSTP | Halt printer at once
PRINOP_PGO | Start printer
PRINOP_OYES | Approve alignment page
PRINOP_ONO | Disapprove alignment page
PRINOP_INTER | Interrupt printer
PRINOP_PJAB | Abort current job on printer

# RETURN VALUES

The function returns 0 if successful otherwise one of the error codes listed in Chapter 3.

# EXAMPLE

An example to halt all printers:

     int     fd, ret, np, i;
     struct apispptr ptr;
     slotno_t *slots;

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

     /* make a list of all the printers */

     ret = gspool_ptrlist(fd, 0, &np, &slots);
     if (ret < 0) { /* error handling */
         ...
     }

     for (i = 0; i < np; i++) {
         ret = gspool_ptrop(fd, GSPOOL_FLAG_IGNORESEQ, slots[i], PRINOP_PHLT);
         if (ret < 0  &&  ret != GSPOOL_PTR_NOTRUNNING) {
             /* error handling ignoring ones already stopped*/
             ...
         }
     }
     gspool_close(fd);

# SEE ALSO

`gspool_ptrlist(3)`, `gspool_ptrread(3)`, `gspool_ptradd(3)`, `gspool_ptrdel(3)`, `gspool_ptrfind(3)`, `gspool_ptrfindslot(3)`, `gspool_ptrupd(3)`, `gspool_ptrmon(3)`.

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