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