xref: /illumos-gate/usr/src/cmd/lp/include/oam.h (revision 2a8bcb4e)
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 #if	!defined(_LP_OAM_H)
31*7c478bd9Sstevel@tonic-gate # define	_LP_OAM_H
32*7c478bd9Sstevel@tonic-gate /*
33*7c478bd9Sstevel@tonic-gate  * Change the following lines to include the appropriate
34*7c478bd9Sstevel@tonic-gate  * standard header file when it becomes available.
35*7c478bd9Sstevel@tonic-gate  * Or change all the LP source to include it directly,
36*7c478bd9Sstevel@tonic-gate  * and get rid of the following stuff (up to the ====...==== line).
37*7c478bd9Sstevel@tonic-gate  */
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate char *agettxt(long msg_id, char *buf, int buflen);
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate void fmtmsg(char * label, int severity, char * text, char * action);
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate /*
44*7c478bd9Sstevel@tonic-gate  * Possible values of "severity":
45*7c478bd9Sstevel@tonic-gate  */
46*7c478bd9Sstevel@tonic-gate #define	MIN_SEVERITY	0
47*7c478bd9Sstevel@tonic-gate #define	HALT		0
48*7c478bd9Sstevel@tonic-gate #define	ERROR		1
49*7c478bd9Sstevel@tonic-gate #define	WARNING		2
50*7c478bd9Sstevel@tonic-gate #define	INFO		3
51*7c478bd9Sstevel@tonic-gate #define	MAX_SEVERITY	3
52*7c478bd9Sstevel@tonic-gate 
53*7c478bd9Sstevel@tonic-gate /**======================================================================
54*7c478bd9Sstevel@tonic-gate  **
55*7c478bd9Sstevel@tonic-gate  ** LP Spooler specific error message handling.
56*7c478bd9Sstevel@tonic-gate  **/
57*7c478bd9Sstevel@tonic-gate 
58*7c478bd9Sstevel@tonic-gate #define	MSGSIZ		512
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate #if	defined(WHO_AM_I)
61*7c478bd9Sstevel@tonic-gate 
62*7c478bd9Sstevel@tonic-gate #include "oam_def.h"
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate #if	WHO_AM_I == I_AM_CANCEL
65*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:cancel";
66*7c478bd9Sstevel@tonic-gate 
67*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_COMB
68*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:comb           ";
69*7c478bd9Sstevel@tonic-gate 				  /* changed inside pgm */
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPMOVE
72*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpmove";
73*7c478bd9Sstevel@tonic-gate 
74*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPUSERS
75*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpusers";
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPNETWORK
78*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpnetwork";
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LP
81*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lp";
82*7c478bd9Sstevel@tonic-gate 
83*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPADMIN
84*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpadmin";
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPFILTER
87*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpfilter";
88*7c478bd9Sstevel@tonic-gate 
89*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPFORMS
90*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpforms";
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPPRIVATE
93*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpprivate";
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPSCHED
96*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpsched";
97*7c478bd9Sstevel@tonic-gate 
98*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPSHUT
99*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpshut";
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPSTAT
102*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpstat";
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate #elif	WHO_AM_I == I_AM_LPSYSTEM
105*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:lpsystem";
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate #else
108*7c478bd9Sstevel@tonic-gate static char		*who_am_i = "UX:mysterious";
109*7c478bd9Sstevel@tonic-gate 
110*7c478bd9Sstevel@tonic-gate #endif
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate /*
113*7c478bd9Sstevel@tonic-gate  * Simpler interfaces to the "fmtmsg()" and "agettxt()" stuff.
114*7c478bd9Sstevel@tonic-gate  */
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate #if	defined(lint)
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate #define LP_ERRMSG(C,X)			(void)printf("", C, X)
119*7c478bd9Sstevel@tonic-gate #define LP_ERRMSG1(C,X,A)		(void)printf("", C, X, A)
120*7c478bd9Sstevel@tonic-gate #define LP_ERRMSG2(C,X,A1,A2)		(void)printf("", C, X, A1, A2)
121*7c478bd9Sstevel@tonic-gate #define LP_ERRMSG3(C,X,A1,A2,A3)	(void)printf("", C, X, A1, A2, A3)
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate #else
124*7c478bd9Sstevel@tonic-gate 
125*7c478bd9Sstevel@tonic-gate #define	LP_ERRMSG(C,X) \
126*7c478bd9Sstevel@tonic-gate 			fmtmsg ( \
127*7c478bd9Sstevel@tonic-gate 				who_am_i, \
128*7c478bd9Sstevel@tonic-gate 				C, \
129*7c478bd9Sstevel@tonic-gate 				agettxt((X), _m_, MSGSIZ), \
130*7c478bd9Sstevel@tonic-gate 				agettxt((X+1), _a_, MSGSIZ) \
131*7c478bd9Sstevel@tonic-gate 			)
132*7c478bd9Sstevel@tonic-gate #define	LP_ERRMSG1(C,X,A) \
133*7c478bd9Sstevel@tonic-gate 			fmtmsg ( \
134*7c478bd9Sstevel@tonic-gate 				who_am_i, \
135*7c478bd9Sstevel@tonic-gate 				C, \
136*7c478bd9Sstevel@tonic-gate 				fmt1((X), A), \
137*7c478bd9Sstevel@tonic-gate 				agettxt((X+1), _a_, MSGSIZ) \
138*7c478bd9Sstevel@tonic-gate 			)
139*7c478bd9Sstevel@tonic-gate #define	LP_ERRMSG2(C,X,A1,A2) \
140*7c478bd9Sstevel@tonic-gate 			fmtmsg ( \
141*7c478bd9Sstevel@tonic-gate 				who_am_i, \
142*7c478bd9Sstevel@tonic-gate 				C, \
143*7c478bd9Sstevel@tonic-gate 				fmt2((X), A1, A2), \
144*7c478bd9Sstevel@tonic-gate 				agettxt((X+1), _a_, MSGSIZ) \
145*7c478bd9Sstevel@tonic-gate 			)
146*7c478bd9Sstevel@tonic-gate #define	LP_ERRMSG3(C,X,A1,A2,A3) \
147*7c478bd9Sstevel@tonic-gate 			fmtmsg ( \
148*7c478bd9Sstevel@tonic-gate 				who_am_i, \
149*7c478bd9Sstevel@tonic-gate 				C, \
150*7c478bd9Sstevel@tonic-gate 				fmt3((X), A1, A2, A3), \
151*7c478bd9Sstevel@tonic-gate 				agettxt((X+1), _a_, MSGSIZ) \
152*7c478bd9Sstevel@tonic-gate 			)
153*7c478bd9Sstevel@tonic-gate 
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate #define	vsnp		(void)snprintf
156*7c478bd9Sstevel@tonic-gate 
157*7c478bd9Sstevel@tonic-gate #define fmt1(X,A)	(vsnp(_m_, MSGSIZ, agettxt((X),_f_,MSGSIZ), A), _m_)
158*7c478bd9Sstevel@tonic-gate #define fmt2(X,A,B)	(vsnp(_m_, MSGSIZ, agettxt((X),_f_,MSGSIZ), A,B), _m_)
159*7c478bd9Sstevel@tonic-gate #define fmt3(X,A,B,C)	(vsnp(_m_, MSGSIZ, agettxt((X),_f_,MSGSIZ), A,B,C), _m_)
160*7c478bd9Sstevel@tonic-gate 
161*7c478bd9Sstevel@tonic-gate #endif	/* lint */
162*7c478bd9Sstevel@tonic-gate 
163*7c478bd9Sstevel@tonic-gate extern char		_m_[],
164*7c478bd9Sstevel@tonic-gate 			_a_[],
165*7c478bd9Sstevel@tonic-gate 			_f_[],
166*7c478bd9Sstevel@tonic-gate 			*_t_;
167*7c478bd9Sstevel@tonic-gate 
168*7c478bd9Sstevel@tonic-gate #endif	/* WHO_AM_I */
169*7c478bd9Sstevel@tonic-gate 
170*7c478bd9Sstevel@tonic-gate #endif
171