Content-type: text/html Man page of getprlpnam


Section: C Library Functions (3)
Index Return to Main Contents


getprlpnam, putprlpnam - Manipulate printer control database entry (Enhanced Security)  


Security Library - libsecurity.a  


#include <sys/types.h> #include <sys/security.h> #include <prot.h>

struct pr_lp *getprlpnam (        char *name );

int putprlpnam (        char *name,
       struct pr_lp *pr );


Specifies a printer control database entry name. Specifies a printer control database entry structure.  


The getprlpnam() function returns a pointer to an object with the following structure containing the broken-out fields of a line in the printer control database. Each line in the database contains a pr_lp structure, declared in the prot.h header file as follows: /* Printer Control Database Entry */

struct l_field {
        char    fd_name[15];    /* holds printer name */
        char    fd_initseq[256];/* initial sequence */
        char    fd_termseq[256];/* termination sequence */
        char    fd_emph[256];   /* emphasize sequence */
        char    fd_deemph[256]; /* de-emphasize sequence */
        char    fd_chrs[130];   /* characters to filter */
        ushort  fd_chrslen;     /* length of string of illegal chars */
        char    fd_escs[256];   /* escape sequences */
        ushort  fd_escslen;     /* length of string: illegal escapes */
        int     fd_linelen;     /* length of a line in characters */
        int     fd_pagelen;     /* length of a page in lines */
        char    fd_truncline;   /* printer truncates long lines? */ };

struct l_flag {
        unsigned short
                fg_name:1,      /* Is fd_name set? */
                fg_initseq:1,   /* Is fd_initseq set? */
                fg_termseq:1,   /* Is fd_termseq set? */
                fg_emph:1,      /* Is fd_emph set? */
                fg_deemph:1,    /* Is fd_deemph set? */
                fg_chrs:1,      /* Is fd_chrs set? */
                fg_chrslen:1,   /* Is fd_chrslen set? */
                fg_escs:1,      /* Is fd_escs set? */
                fg_escslen:1,   /* Is fd_escslen set? */
                fg_linelen:1,   /* Is fd_linelen set? */
                fg_pagelen:1,   /* Is fd_pagelen set? */
                fg_truncline:1  /* Is fd_truncline set? */
                ; };

struct pr_lp {
        struct l_field ufld;
        struct l_flag uflg;
        struct l_field sfld;
        struct l_flag sflg; };

The getprlpnam() function searches from the beginning of the database until a printer name matching name is found, and returns a pointer to the particular structure in which it was found. If an end-of-file or an error is encountered on reading, the function returns a null pointer.

The putprlpnam() function puts a new or replaced printer control entry pr with key name into the database. If the uflg.fg_name field is 0, the requested entry is deleted from the printer control database. The putprlpnam() function locks the database for all update operations, and performs a endprlpent() after the update or failed attempt.

For ASCII printers, the fields in the printer control database contain the characteristics of the printer so the trusted line printer subsystem can apply labels to the top and bottom of printed pages.

The ufld.fd_name field matches the printer model, supplied by the line printer scheduler to the lprcat program to access the appropriate entry in this database. The ufld.fd_initseq field is a null-terminated string containing the initialization sequence for the printer; it is sent by line printer software at the start of each job.

Similarly, ufld.fd_termseq contains a null-terminated string, which is sent to the printer when each job is complete. The size of the printed page is specified in ufld.fd_linelen (width) and ufld.fd_pagelen (height). These values are expressed in characters for dot matrix printers, and points (1/72 inch) for laser printers. Other values are used for character filtering (supported only on dot matrix printers).

The ufld.fd_emph field is a null-terminated character string that causes the printer to begin emphasizing characters printed. Similarly, ufld.fd_deemph is a null-terminated character string that resumes normal printing. The ufld.fd_chrs array is a list of characters that is automatically filtered out by the line printer software because it causes carriage motion that would cause the line printer software to lose its place on the page. The length of this array is ufld.fd_chrslen.

The ufld.fd_escs string contains characters that cause carriage motion after an escape character (ASCII \033). The ufld.fd_truncline Boolean indicator specifies whether the printer truncates lines when they are too long. This allows the printer software to keep track of the logical line printed.  


All information is contained in a static area, so it must be copied if it is to be saved. Specifically, specifying a buffer returned to putprlpnam() does not perform the intended action.

Programs using this functions must be compiled with -lsecurity.  


A null pointer is returned on EOF or error.  


Line printer subsystem configuration file. General security databases file.  


Functions: getprpwent(3), getprtcent(3), getprdfent(3)

Security delim off




This document was created by man2html, using the manual pages.
Time: 02:42:29 GMT, October 02, 2010