LP(4,F) AIX Technical Reference LP(4,F)
-------------------------------------------------------------------------------
lp
PURPOSE
Supports the line printer device driver.
SYNOPSIS
#include <sys/lprio.h>
DESCRIPTION
The lp driver provides an interface to the port used by a printer. The driver
is unique to AIX PS/2. If a port for a printer is not installed, an attempt to
open fails. The close system call waits until all output completes before
returning to the user. The lp driver allows only one process to write to a
printer port at a time. If the printer port is busy, the open system call
returns an error. However, the driver allows multiple open system calls to
occur if they are read-only. Thus, the splp command can be run when the
printer port is currently in use.
The lp driver interprets carriage returns, backspaces, line feeds, tabs, and
form feeds depending on the modes that are set in the driver (via splp). The
number of lines per page, columns per line, and the indent at the beginning of
each line can also be selected. The defaults are set at 66 lines per page, and
80 columns per line with no indenting.
ioctl Operations
Syntax for the enhanced control function is:
#include <sys/lprio.h>
ioctl (fildes,command,arg)
int fildes; /* file descriptor */
int command; /* command type */
struct LPRUDE *arg; /* pointer to info structure */
The possible command types and their descriptions are:
IOCINFO Returns a structure defined in sys/devinfo.h, which describes the
device.
IOCTYPE Returns device LPR (line printer) defined in sys/devinfo.h.
LPRGET Gets page length, width, and indent. This structure is defined in
sys/lprio.h.
Processed November 7, 1990 LP(4,F) 1
LP(4,F) AIX Technical Reference LP(4,F)
LPRGETA Gets the RS232 parameters. These are the values for baud rate,
character size, stop bits, and parity. Refer to the LPR232 structure
and to the termio.h structure.
LPRGETV Gets optional line printer modes. See the following LPRMODE
structure.
LPRGMOD Gets the AIX optional printer modes. These optional printer modes
support the synchronous versus asynchronous write interface, as well
as the report all errors versus wait until error correction error
reporting mode. Refer to the following OPRMODE structure.
The FONTINIT flag is initially off. It is turned on by an application
when a printer font has been initialized. It is turned off when an
application wants fonts to be reinitialized and by the lp device
driver when a FATAL printer error occurs.
LPRSET Sets page length, width, and indent values. This structure is defined
in sys/lprio.h.
LPRSETA Sets the RS232 parameters. These are the values for baud rate,
character size, stop bits, and parity. Refer to the LPR232 structure
that follows and to the termio.h structure.
LPRSETV Sets optional line printer modes. See the following LPRMODE
structure.
LPRSMOD Sets the AIX optional printer modes. These optional printer modes
support the synchronous versus asynchronous write interface, as well
as the report all errors versus wait until error correction reporting
mode. Refer to the following OPRMODE structure.
The FONTINIT flag is initially off. It is turned on by an application
when a printer font has been initialized. It is turned off when an
application wants fonts to be reinitialized and by the lp device
driver when a FATAL printer error occurs.
LPRUFLS Flushes any data currently in progress and causes the printer to be
initialized. This can be used during the course of normal print
operations, or following an error indication.
LPRUGES Gets the device driver error structure (LPRUDE). The arg parameter
must be specified to point to the structure.
LPRURES Resumes printing from the point of interruption following an error.
If an error did not occur, then this control has no effect.
LPRGTOV Gets the current timeout value and stores it in the lptimer structure
pointed to by the arg parameter. The timeout value is measured in
seconds.
Processed November 7, 1990 LP(4,F) 2
LP(4,F) AIX Technical Reference LP(4,F)
LPRSTOV Sets the timeout value. The arg parameter points to a lptimer
structure. The timeout value must be given in seconds.
Most of these ioctl operations require the arg parameter to point to one of the
following structures:
struct devinfo
{ char devtype; /* devtype for printer is '1' */
char flags;
};
/* used with LPRGET, LPRSET */
struct lprio {
int ind; /* indent value */
int col; /* maximum character count */
int line; /* maximum line count */
};
/* used with LPRGETV, LPRSETV */
struct lprmode {
int modes; /* optional line printer modes */
};
/* bit definitions for the modes field in LPRMODE */
#define PLOT 01 /* if on, no interpretation of any character */
#define NOFF 0400 /* if on, simulate the form-feed function */
#define NONL 01000 /* if on, substitute carriage returns for */
/* any line-feeds */
Processed November 7, 1990 LP(4,F) 3
LP(4,F) AIX Technical Reference LP(4,F)
#define NOTB 02000 /* if on, don't expand tabs, else simulate */
/* 8 position tabs with spaces */
#define NOBS 04000 /* if on, no backspaces to the printer */
#define NOCR 010000 /* if on, substitute line-feeds for any */
/* carriage returns */
#define CAPS 020000 /* if on, map lower-case alphabetics */
/* to upper case */
#define WRAP 040000 /* if on, print characters beyond the page */
/* width on the next line, instead of */
/* truncating */
struct oprmode {
int flags; /* optional line printer modes */
};
#define LPRSYNC 01 /* asynchronous is default. */
/* synchronous if on */
#define LPRALLERR 02 /* wait until error correction is default.*/
/* report all errors if on */
#define LPRFONTINIT 04 /* file initialization */
struct LPRUDE /* device error-reporting structure */
{
int status; /* error reason code */
int cresult; /* current operation result */
int tadapt; /* adapter type */
int npio; /* number of pending IO operations */
};
/* status values - error reason codes */
struct lpr232 /* settings for RS232 */
{
unsigned c_cflag; /* error reason code */
};
/* used with LPRGTOV and LPRSTOV */
struct lptimer
{
unsigned v_timeout; /* timeout value in seconds */
}
FILE
/dev/lp*
RELATED INFORMATION
In this book: "ioctlx, ioctl, gtty, stty," "devinfo," and "asy."
The splp command in AIX Operating System Commands Reference.
Processed November 7, 1990 LP(4,F) 4
LP(4,F) AIX Technical Reference LP(4,F)
-------------------------------------------------------------------------------
lp
PURPOSE
Supports the IBM virtual line printer driver
SYNOPSIS
#include<sys/devinfo.h>
#include<sys/b370/lpdev.h>
DESCRIPTION
This command is unique to AIX System/370.
The AIX/370 printer is based on the underlying VM spooled printer. Therefore,
the driver is for the virtual 1403 or equivalent printer.
The special files used to write from the card punch is of the form /dev/lp#,
where # is the device unit number.
The card printer can only be opened for writing. The record size of each card
is determined by the buffer size specified to the write system call. When the
device is closed, a corresponding close is issued to the VM punch device.
A few IOCTL operations are available besides the standard. IOCTYPE and IOCINFO
commands. They are of the form
ioctl(fd, cmd, arg)
char *arg:
The commands are:
#define PRTsettag 1 /* set tag text */
#define PRTpurge 2 /* purge any previous records */
#define PRTto 3 /* set "TO userid" option */
#define PRTclass 4 /* set spool file class */
#define PRTcopy 5 /* set number of copies */
#define PRTform 6 /* set form identifier */
#define PRTdist 7 /* set distcode */
#define PRTfname 8 /* set file name text */
#define PRTxlate 9 /* load translate table */
ERROR CONDITIONS
In addition to the errors listed in the ioctl, open, and write manual pages,
system calls to this device can fail in the following circumstances:
Processed November 7, 1990 LP(4,F) 1
LP(4,F) AIX Technical Reference LP(4,F)
ENXIO Attempt to read from the printer.
EIO The I/O to the printer failed during the operation.
RELATED INFORMATION
In this book, "ioctlx, ioctl, gtty, stty," "open, openx, creat," and "write,
writex."
Processed November 7, 1990 LP(4,F) 2