xref: /titanic_50/usr/src/cmd/lp/cmd/lpadmin/send_message.c (revision 71269a2275bf5a143dad6461eee2710a344e7261)
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 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 #ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.9	*/
27 
28 #include "stdio.h"
29 
30 #if	defined(__STDC__)
31 #include "stdarg.h"
32 #else
33 #include "varargs.h"
34 #endif
35 
36 #include "msgs.h"
37 
38 #define	WHO_AM_I	I_AM_LPADMIN
39 #include "oam.h"
40 
41 #include "lpadmin.h"
42 
43 
44 /**
45  ** send_message() - HANDLE MESSAGE SENDING TO SPOOLER
46  **/
47 
48 /*VARARGS1*/
49 
50 void
51 #if	defined(__STDC__)
52 send_message (
53 	int			type,
54 	...
55 )
56 #else
57 send_message (type, va_alist)
58 	int			type;
59 	va_dcl
60 #endif
61 {
62 	va_list			ap;
63 
64 	int			n;
65 
66 	char			msgbuf[MSGMAX];
67 
68 
69 	if (!scheduler_active)
70 		return;
71 
72 #if	defined(__STDC__)
73 	va_start (ap, type);
74 #else
75 	va_start (ap);
76 #endif
77 
78 	(void)_putmessage (msgbuf, type, ap);
79 
80 	va_end (ap);
81 
82 	if (msend(msgbuf) == -1) {
83 		LP_ERRMSG (ERROR, E_LP_MSEND);
84 		done(1);
85 	}
86 
87 	return;
88 }
89