4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
21 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
22 /* All Rights Reserved */
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #if !defined(_LP_PRINTERS_H)
33 #define _LP_PRINTERS_H
36 * Define the following to support administrator configurable
39 #define CAN_DO_MODULES 1 /* */
42 ** The disk copy of the printer files:
46 * There are 19 fields in the printer configuration file.
65 # define PR_MODULES 16
70 ** The internal flags seen by the Spooler/Scheduler and anyone who asks.
73 #define PS_REJECTED 0x001
74 #define PS_DISABLED 0x002
75 #define PS_FAULTED 0x004
77 #define PS_LATER 0x010 /* Printer is scheduled for service */
78 #define PS_SHOW_FAULT 0x100 /* set if exMess should be run when fault */
79 #define PS_USE_AS_KEY 0x200 /* to insure that status used as key is non 0 */
80 #define PS_FORM_FAULT 0x400 /* set a form fault rather a printer fault*/
83 ** The internal copy of a printer as seen by the rest of the world:
87 * A (char **) list is an array of string pointers (char *) with
88 * a null pointer after the last item.
90 typedef struct PRINTER
{
91 char *name
; /* name of printer (redundant) */
92 unsigned short banner
; /* banner page conditions */
93 SCALED cpi
; /* default character pitch */
94 char **char_sets
; /* list of okay char-sets/print-wheels */
95 char **input_types
; /* list of types acceptable to printer */
96 char *device
; /* printer port full path name */
97 char *dial_info
; /* system name or phone # for dial-up */
98 char *fault_rec
; /* printer fault recovery procedure */
99 char *interface
; /* interface program full path name */
100 SCALED lpi
; /* default line pitch */
101 SCALED plen
; /* default page length */
102 unsigned short login
; /* is/isn't a login terminal */
103 char *printer_type
; /* Terminfo look-up value (obsolete) */
104 char *remote
; /* remote machine!printer-name */
105 char *speed
; /* baud rate for connection */
106 char *stty
; /* space separated list of stty options */
107 SCALED pwid
; /* default page width */
108 char *description
; /* comment about printer */
109 FALERT fault_alert
; /* how to alert on printer fault */
110 short daisy
; /* 1/0 - printwheels/character-sets */
111 #if defined(CAN_DO_MODULES)
112 char **modules
; /* streams modules to push */
114 char **printer_types
; /* Terminfo look-up values */
115 char **options
; /* space separated list of undefined -o options */
117 #ifdef LP_USE_PAPI_ATTR
118 char *ppd
; /* printer's PPD file full path name */
121 * Adding new members to this structure? Check out
122 * cmd/lpadmin/do_printer.c, where we initialize
123 * each new printer structure.
127 #define BAN_ALWAYS 0x01 /* user can't override banner */
128 #define BAN_OFF 0x02 /* don't print banner page */
129 #define BAN_NEVER BAN_OFF
130 #define BAN_OPTIONAL (BAN_ALWAYS | BAN_NEVER) /* user can override banner */
132 #define LOG_IN 0x01 /* printer is login terminal */
134 #define PCK_TYPE 0x0001 /* printer type isn't in Terminfo */
135 #define PCK_CHARSET 0x0002 /* printer type can't handle ".char_sets" */
136 #define PCK_CPI 0x0004 /* printer type can't handle ".cpi" */
137 #define PCK_LPI 0x0008 /* printer type can't handle ".lpi" */
138 #define PCK_WIDTH 0x0010 /* printer type can't handle ".pwid" */
139 #define PCK_LENGTH 0x0020 /* printer type can't handle ".plen" */
140 #define PCK_PAPER 0x0040 /* printer type can't handle paper */
143 * The following PCK_... bits are only set by the Spooler,
144 * when refusing a request.
146 #define PCK_BANNER 0x1000 /* printer needs banner */
149 * Flags set by "putprinter()" for things that go wrong.
151 #define BAD_REMOTE 0x0001 /* has attributes of remote and local */
152 #define BAD_INTERFACE 0x0002 /* no interface or can't read it */
153 #define BAD_DEVDIAL 0x0004 /* no device or dial information */
154 #define BAD_FAULT 0x0008 /* not recognized fault recovery */
155 #define BAD_ALERT 0x0010 /* has reserved word for alert command */
156 #define BAD_ITYPES 0x0020 /* multiple printer AND input types */
157 #define BAD_PTYPES 0x0040 /* multiple printer types, incl unknown */
158 #define BAD_DAISY 0x0080 /* printer types don't agree on "daisy" */
161 * A comma separated list of STREAMS modules to be pushed on an
164 #define DEFMODULES "ldterm"
170 typedef struct PWHEEL
{
171 char *name
; /* name of print wheel */
172 FALERT alert
; /* how to alert when mount needed */
175 extern unsigned long badprinter
,
179 * Set if ppd file information is from the user rather than
180 * the configuration file.
188 PRINTER
* getprinter ( char * );
190 PWHEEL
* getpwheel ( char * );
192 char * getdefault ( void );
194 int putprinter ( char *, PRINTER
*);
195 int delprinter ( char * );
196 int putdefault ( char * );
197 int deldefault ( void );
198 int putpwheel ( char * , PWHEEL
* );
199 int delpwheel ( char * );
200 int okprinter ( char * , PRINTER
* , int );
202 unsigned long chkprinter (char *, char *, char *, char *, char *, char *);
204 void freeprinter ( PRINTER
* );
205 void freepwheel ( PWHEEL
* );
207 char * getpentry(char *, int);
210 ** Aliases (copies) of some important Terminfo caps.