xref: /illumos-gate/usr/src/cmd/sgs/libconv/common/map.c (revision e4d060fb4c00d44cd578713eb9a921f594b733b8)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * String conversion routines for mapfile related items.
29  * These items are not ELF constructs. However, we have a need
30  * to display them.
31  */
32 #include	<stdio.h>
33 #include	<_conv.h>
34 #include	<map_msg.h>
35 
36 const char *
37 conv_mapfile_version(Word version, Conv_fmt_flags_t fmt_flags,
38     Conv_inv_buf_t *inv_buf)
39 {
40 	static const Msg	versions[] = {
41 		MSG_VER_NONE,	MSG_VER_SYSV,	MSG_VER_SOLARIS
42 	};
43 #if MFV_NUM != (MFV_SOLARIS + 1)
44 #error "NT_NUM has grown. Update mapfile versions[]"
45 #endif
46 	static const conv_ds_msg_t ds_versions = {
47 	    CONV_DS_MSG_INIT(MFV_NONE, versions) };
48 	static const conv_ds_t	*ds[] = { CONV_DS_ADDR(ds_versions), NULL };
49 
50 	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, version, ds, fmt_flags,
51 	    inv_buf));
52 }
53