xref: /titanic_52/usr/src/cmd/sgs/libconv/common/group.c (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  *	Use is subject to license terms.
25  */
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include	<string.h>
29 #include	"rtld.h"
30 #include	"_conv.h"
31 #include	"group_msg.h"
32 
33 #define	FLAGSZ	MSG_GBL_OSQBRKT_SIZE + \
34 		MSG_GPH_INITIAL_SIZE + \
35 		MSG_GPH_ZERO_SIZE + \
36 		MSG_GPH_LDSO_SIZE + \
37 		MSG_GPH_FIRST_SIZE + \
38 		MSG_GPH_PARENT_SIZE + \
39 		MSG_GPH_FILTEE_SIZE + \
40 		MSG_GBL_CSQBRKT_SIZE
41 
42 /*
43  * String conversion routine for Grp_hdl flags.
44  */
45 const char *
46 conv_grphdrflags_str(uint_t flags)
47 {
48 	static	char	string[FLAGSZ] = { '\0' };
49 
50 	(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
51 
52 	if (flags == 0)
53 		return (MSG_ORIG(MSG_GBL_NULL));
54 
55 	if (flags & GPH_INITIAL)
56 		(void) strcat(string, MSG_ORIG(MSG_GPH_INITIAL));
57 	if (flags & GPH_ZERO)
58 		(void) strcat(string, MSG_ORIG(MSG_GPH_ZERO));
59 	if (flags & GPH_LDSO)
60 		(void) strcat(string, MSG_ORIG(MSG_GPH_LDSO));
61 	if (flags & GPH_FIRST)
62 		(void) strcat(string, MSG_ORIG(MSG_GPH_FIRST));
63 	if (flags & GPH_PARENT)
64 		(void) strcat(string, MSG_ORIG(MSG_GPH_PARENT));
65 	if (flags & GPH_FILTEE)
66 		(void) strcat(string, MSG_ORIG(MSG_GPH_FILTEE));
67 	if (flags & GPH_STICKY)
68 		(void) strcat(string, MSG_ORIG(MSG_GPH_STICKY));
69 
70 	(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
71 
72 	return ((const char *)string);
73 }
74