4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.19 */
32 /* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
35 #include "sys/types.h"
42 unsigned long badprinter
= 0;
44 static int okinterface ( char * , PRINTER
* );
47 ** okprinter() - SEE IF PRINTER STRUCTURE IS SOUND
51 okprinter(char *name
, PRINTER
*prbufp
, int isput
)
56 * A printer can't be remote and have device, interface,
57 * fault recovery, or alerts.
65 prbufp
->fault_alert
.shcmd
66 && !STREQU(NAME_NONE
, prbufp
->fault_alert
.shcmd
)
68 #if defined(CAN_DO_MODULES)
71 * This needs some work...getprinter() initializes this to "default"
74 !emptylist(prbufp
->modules
)
75 && !STREQU(NAME_NONE
, prbufp
->modules
[0])
81 badprinter
|= BAD_REMOTE
;
84 * A local printer must have an interface program. This is
85 * for historical purposes (it let's someone know where the
86 * interface program came from) AND is used by "putprinter()"
87 * to copy the interface program. We must be able to read it.
89 if (!prbufp
->remote
&& isput
&& !okinterface(name
, prbufp
))
90 badprinter
|= BAD_INTERFACE
;
93 * A local printer must have device or dial info.
95 if (!prbufp
->remote
&& !prbufp
->device
&& !prbufp
->dial_info
)
96 badprinter
|= BAD_DEVDIAL
;
99 * Fault recovery must be one of three kinds
104 && !STREQU(prbufp
->fault_rec
, NAME_CONTINUE
)
105 && !STREQU(prbufp
->fault_rec
, NAME_BEGINNING
)
106 && !STREQU(prbufp
->fault_rec
, NAME_WAIT
)
108 badprinter
|= BAD_FAULT
;
111 * Alert command can't be reserved word.
114 prbufp
->fault_alert
.shcmd
116 STREQU(prbufp
->fault_alert
.shcmd
, NAME_QUIET
)
117 || STREQU(prbufp
->fault_alert
.shcmd
, NAME_LIST
)
120 badprinter
|= BAD_ALERT
;
122 return ((badprinter
& ~ignprinter
)? 0 : 1);
126 ** okinterface() - CHECK THAT THE INTERFACE PROGRAM IS OKAY
132 return ((access(path
, R_OK
) < 0) ? 0 : 1);
136 okinterface(char *name
, PRINTER
*prbufp
)
143 if (prbufp
->interface
)
144 ret
= canread(prbufp
->interface
);
147 if (!(path
= makepath(Lp_A_Interfaces
, name
, (char *)0)))