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
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.
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]
22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
26 #ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
35 extern char *_lp_msg_fmts
[];
40 int _getmessage ( char * buf
, short rtype
, va_list arg
)
42 int _getmessage (buf
, rtype
, arg
)
63 * We assume that we're given a buffer big enough to hold
67 endbuf
= buf
+ (long)stoh(buf
);
68 if ((buf
+ MESG_DATA
) > endbuf
)
74 etype
= stoh(buf
+ MESG_TYPE
);
75 if (etype
< 0 || etype
> LAST_MESSAGE
)
83 if (rtype
> 0 && rtype
<= LAST_MESSAGE
)
84 fmt
= _lp_msg_fmts
[rtype
];
92 fmt
= _lp_msg_fmts
[etype
];
100 if ((buf
+ 4) > endbuf
)
106 t_short
= va_arg(arg
, short *);
107 *t_short
= stoh(buf
);
112 if ((buf
+ 8) > endbuf
)
118 t_long
= va_arg(arg
, long *);
124 if ((buf
+ 4) > endbuf
)
130 t_short
= va_arg(arg
, short *);
131 *t_short
= stoh(buf
);
133 t_string
= va_arg(arg
, char **);
134 if ((buf
+ *t_short
) > endbuf
)
139 (*t_short
)--; /* Don't mention the null we added */
145 if ((buf
+ 4) > endbuf
)
151 t_string
= va_arg(arg
, char **);
154 if ((buf
+ temp
) > endbuf
)