xref: /titanic_51/usr/src/cmd/lp/include/oam.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 1999 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.9	*/
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #if	!defined(_LP_OAM_H)
35*7c478bd9Sstevel@tonic-gate # define	_LP_OAM_H
36*7c478bd9Sstevel@tonic-gate /*
37*7c478bd9Sstevel@tonic-gate  * Change the following lines to include the appropriate
38*7c478bd9Sstevel@tonic-gate  * standard header file when it becomes available.
39*7c478bd9Sstevel@tonic-gate  * Or change all the LP source to include it directly,
40*7c478bd9Sstevel@tonic-gate  * and get rid of the following stuff (up to the ====...==== line).
41*7c478bd9Sstevel@tonic-gate  */
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate char *agettxt(long msg_id, char *buf, int buflen);
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate void fmtmsg(char * label, int severity, char * text, char * action);
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate /*
48*7c478bd9Sstevel@tonic-gate  * Possible values of "severity":
49*7c478bd9Sstevel@tonic-gate  */
50*7c478bd9Sstevel@tonic-gate #define	MIN_SEVERITY	0
51*7c478bd9Sstevel@tonic-gate #define	HALT		0
52*7c478bd9Sstevel@tonic-gate #define	ERROR		1
53*7c478bd9Sstevel@tonic-gate #define	WARNING		2
54*7c478bd9Sstevel@tonic-gate #define	INFO		3
55*7c478bd9Sstevel@tonic-gate #define	MAX_SEVERITY	3
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate /**======================================================================
58*7c478bd9Sstevel@tonic-gate  **
59*7c478bd9Sstevel@tonic-gate  ** LP Spooler specific error message handling.
60*7c478bd9Sstevel@tonic-gate  **/
61*7c478bd9Sstevel@tonic-gate 
62*7c478bd9Sstevel@tonic-gate #define	MSGSIZ		512
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate #if	defined(WHO_AM_I)
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate #include "oam_def.h"
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate #if	WHO_AM_I == I_AM_CANCEL
69*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:cancel";
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_COMB
72*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:comb           ";
73*7c478bd9Sstevel@tonic-gate 				  /* changed inside pgm */
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPMOVE
76*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpmove";
77*7c478bd9Sstevel@tonic-gate 
78*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPUSERS
79*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpusers";
80*7c478bd9Sstevel@tonic-gate 
81*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPNETWORK
82*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpnetwork";
83*7c478bd9Sstevel@tonic-gate 
84*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LP
85*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lp";
86*7c478bd9Sstevel@tonic-gate 
87*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPADMIN
88*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpadmin";
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPFILTER
91*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpfilter";
92*7c478bd9Sstevel@tonic-gate 
93*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPFORMS
94*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpforms";
95*7c478bd9Sstevel@tonic-gate 
96*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPPRIVATE
97*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpprivate";
98*7c478bd9Sstevel@tonic-gate 
99*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPSCHED
100*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpsched";
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPSHUT
103*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpshut";
104*7c478bd9Sstevel@tonic-gate 
105*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPSTAT
106*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpstat";
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPSYSTEM
109*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpsystem";
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate #else
112*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:mysterious";
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate #endif
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate /*
117*7c478bd9Sstevel@tonic-gate  * Simpler interfaces to the "fmtmsg()" and "agettxt()" stuff.
118*7c478bd9Sstevel@tonic-gate  */
119*7c478bd9Sstevel@tonic-gate 
120*7c478bd9Sstevel@tonic-gate #if	defined(lint)
121*7c478bd9Sstevel@tonic-gate 
122*7c478bd9Sstevel@tonic-gate #define LP_ERRMSG(C,X)			(void)printf("", C, X)
123*7c478bd9Sstevel@tonic-gate #define LP_ERRMSG1(C,X,A)		(void)printf("", C, X, A)
124*7c478bd9Sstevel@tonic-gate #define LP_ERRMSG2(C,X,A1,A2)		(void)printf("", C, X, A1, A2)
125*7c478bd9Sstevel@tonic-gate #define LP_ERRMSG3(C,X,A1,A2,A3)	(void)printf("", C, X, A1, A2, A3)
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate #else
128*7c478bd9Sstevel@tonic-gate 
129*7c478bd9Sstevel@tonic-gate #define	LP_ERRMSG(C,X) \
130*7c478bd9Sstevel@tonic-gate 			fmtmsg ( \
131*7c478bd9Sstevel@tonic-gate 				who_am_i, \
132*7c478bd9Sstevel@tonic-gate 				C, \
133*7c478bd9Sstevel@tonic-gate 				agettxt((X), _m_, MSGSIZ), \
134*7c478bd9Sstevel@tonic-gate 				agettxt((X+1), _a_, MSGSIZ) \
135*7c478bd9Sstevel@tonic-gate 			)
136*7c478bd9Sstevel@tonic-gate #define	LP_ERRMSG1(C,X,A) \
137*7c478bd9Sstevel@tonic-gate 			fmtmsg ( \
138*7c478bd9Sstevel@tonic-gate 				who_am_i, \
139*7c478bd9Sstevel@tonic-gate 				C, \
140*7c478bd9Sstevel@tonic-gate 				fmt1((X), A), \
141*7c478bd9Sstevel@tonic-gate 				agettxt((X+1), _a_, MSGSIZ) \
142*7c478bd9Sstevel@tonic-gate 			)
143*7c478bd9Sstevel@tonic-gate #define	LP_ERRMSG2(C,X,A1,A2) \
144*7c478bd9Sstevel@tonic-gate 			fmtmsg ( \
145*7c478bd9Sstevel@tonic-gate 				who_am_i, \
146*7c478bd9Sstevel@tonic-gate 				C, \
147*7c478bd9Sstevel@tonic-gate 				fmt2((X), A1, A2), \
148*7c478bd9Sstevel@tonic-gate 				agettxt((X+1), _a_, MSGSIZ) \
149*7c478bd9Sstevel@tonic-gate 			)
150*7c478bd9Sstevel@tonic-gate #define	LP_ERRMSG3(C,X,A1,A2,A3) \
151*7c478bd9Sstevel@tonic-gate 			fmtmsg ( \
152*7c478bd9Sstevel@tonic-gate 				who_am_i, \
153*7c478bd9Sstevel@tonic-gate 				C, \
154*7c478bd9Sstevel@tonic-gate 				fmt3((X), A1, A2, A3), \
155*7c478bd9Sstevel@tonic-gate 				agettxt((X+1), _a_, MSGSIZ) \
156*7c478bd9Sstevel@tonic-gate 			)
157*7c478bd9Sstevel@tonic-gate 
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate #define	vsnp		(void)snprintf
160*7c478bd9Sstevel@tonic-gate 
161*7c478bd9Sstevel@tonic-gate #define fmt1(X,A)	(vsnp(_m_, MSGSIZ, agettxt((X),_f_,MSGSIZ), A), _m_)
162*7c478bd9Sstevel@tonic-gate #define fmt2(X,A,B)	(vsnp(_m_, MSGSIZ, agettxt((X),_f_,MSGSIZ), A,B), _m_)
163*7c478bd9Sstevel@tonic-gate #define fmt3(X,A,B,C)	(vsnp(_m_, MSGSIZ, agettxt((X),_f_,MSGSIZ), A,B,C), _m_)
164*7c478bd9Sstevel@tonic-gate 
165*7c478bd9Sstevel@tonic-gate #endif	/* lint */
166*7c478bd9Sstevel@tonic-gate 
167*7c478bd9Sstevel@tonic-gate extern char		_m_[],
168*7c478bd9Sstevel@tonic-gate 			_a_[],
169*7c478bd9Sstevel@tonic-gate 			_f_[],
170*7c478bd9Sstevel@tonic-gate 			*_t_;
171*7c478bd9Sstevel@tonic-gate 
172*7c478bd9Sstevel@tonic-gate #endif	/* WHO_AM_I */
173*7c478bd9Sstevel@tonic-gate 
174*7c478bd9Sstevel@tonic-gate #endif
175