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