xref: /onnv-gate/usr/src/cmd/sgs/libelf/misc/nplist.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  *	Copyright (c) 1988 AT&T
24*0Sstevel@tonic-gate  *	  All Rights Reserved
25*0Sstevel@tonic-gate  *
26*0Sstevel@tonic-gate  *
27*0Sstevel@tonic-gate  *	Copyright (c) 1999 by Sun Microsystems, Inc.
28*0Sstevel@tonic-gate  *	All rights reserved.
29*0Sstevel@tonic-gate  */
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI" 	/* SVr4.0 1.2	*/
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #include	"elf_dem.h"
33*0Sstevel@tonic-gate #include	<string.h>
34*0Sstevel@tonic-gate #include	"msg.h"
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate struct name_pair {
37*0Sstevel@tonic-gate #ifdef __lint
38*0Sstevel@tonic-gate 	char	* s1, * s2;
39*0Sstevel@tonic-gate #else
40*0Sstevel@tonic-gate 	int	s1, s2;
41*0Sstevel@tonic-gate #endif
42*0Sstevel@tonic-gate };
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate struct name_pair nplist[100] = {
45*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_LT)		MSG_ORIG(MSG_STR_OPNANGBRAK) */
46*0Sstevel@tonic-gate 	{ MSG_STR_LT,	MSG_STR_OPNANGBRAK },
47*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_LS)		MSG_ORIG(MSG_STR_DBLOPNANGBRAK) */
48*0Sstevel@tonic-gate 	{ MSG_STR_LS,	MSG_STR_DBLOPNANGBRAK },
49*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_DV)		MSG_ORIG(MSG_STR_SLASH) */
50*0Sstevel@tonic-gate 	{ MSG_STR_DV,	MSG_STR_SLASH },
51*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_GT)		MSG_ORIG(MSG_STR_CLOANGBRAK) */
52*0Sstevel@tonic-gate 	{ MSG_STR_GT,	MSG_STR_CLOANGBRAK },
53*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_RS)		MSG_ORIG(MSG_STR_DBLCLOANGBRAK) */
54*0Sstevel@tonic-gate 	{ MSG_STR_RS,	MSG_STR_DBLCLOANGBRAK },
55*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_MD)		MSG_ORIG(MSG_STR_PERCENT) */
56*0Sstevel@tonic-gate 	{ MSG_STR_MD,	MSG_STR_PERCENT },
57*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_LE)		MSG_ORIG(MSG_STR_OPNANGBRAKEQU) */
58*0Sstevel@tonic-gate 	{ MSG_STR_LE,	MSG_STR_OPNANGBRAKEQU },
59*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_ML)		MSG_ORIG(MSG_STR_STAR) */
60*0Sstevel@tonic-gate 	{ MSG_STR_ML,	MSG_STR_STAR },
61*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_PL)		MSG_ORIG(MSG_STR_PLUS) */
62*0Sstevel@tonic-gate 	{ MSG_STR_PL,	MSG_STR_PLUS },
63*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_GE)		MSG_ORIG(MSG_STR_CLOANGBRAKEQU) */
64*0Sstevel@tonic-gate 	{ MSG_STR_GE,	MSG_STR_CLOANGBRAKEQU },
65*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_AD)		MSG_ORIG(MSG_STR_AMP) */
66*0Sstevel@tonic-gate 	{ MSG_STR_AD,	MSG_STR_AMP },
67*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_MI)		MSG_ORIG(MSG_STR_MINUS) */
68*0Sstevel@tonic-gate 	{ MSG_STR_MI,	MSG_STR_MINUS },
69*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_NE)		MSG_ORIG(MSG_STR_BANGEQU) */
70*0Sstevel@tonic-gate 	{ MSG_STR_NE,	MSG_STR_BANGEQU },
71*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_OR)		MSG_ORIG(MSG_STR_PIPE) */
72*0Sstevel@tonic-gate 	{ MSG_STR_OR,	MSG_STR_PIPE },
73*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_ER)		MSG_ORIG(MSG_STR_CARAT) */
74*0Sstevel@tonic-gate 	{ MSG_STR_ER,	MSG_STR_CARAT },
75*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_AA)		MSG_ORIG(MSG_STR_DBLAMP) */
76*0Sstevel@tonic-gate 	{ MSG_STR_AA,	MSG_STR_DBLAMP },
77*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_OO)		MSG_ORIG(MSG_STR_DBLPIPE) */
78*0Sstevel@tonic-gate 	{ MSG_STR_OO,	MSG_STR_DBLPIPE },
79*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_AS)		MSG_ORIG(MSG_STR_EQU) */
80*0Sstevel@tonic-gate 	{ MSG_STR_AS,	MSG_STR_EQU },
81*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_APL)	MSG_ORIG(MSG_STR_PLUSEQU) */
82*0Sstevel@tonic-gate 	{ MSG_STR_APL,	MSG_STR_PLUSEQU },
83*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_AMI)	MSG_ORIG(MSG_STR_MINUSEQU) */
84*0Sstevel@tonic-gate 	{ MSG_STR_AMI,	MSG_STR_MINUSEQU },
85*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_AMU)	MSG_ORIG(MSG_STR_STARTEQU) */
86*0Sstevel@tonic-gate 	{ MSG_STR_AMU,	MSG_STR_STARTEQU },
87*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_ADV)	MSG_ORIG(MSG_STR_SLASHEQU) */
88*0Sstevel@tonic-gate 	{ MSG_STR_ADV,	MSG_STR_SLASHEQU },
89*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_AMD)	MSG_ORIG(MSG_STR_PERCENTEQU) */
90*0Sstevel@tonic-gate 	{ MSG_STR_AMD,	MSG_STR_PERCENTEQU },
91*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_AAD)	MSG_ORIG(MSG_STR_AMPEQU) */
92*0Sstevel@tonic-gate 	{ MSG_STR_AAD,	MSG_STR_AMPEQU },
93*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_AOR)	MSG_ORIG(MSG_STR_PIPEEQU) */
94*0Sstevel@tonic-gate 	{ MSG_STR_AOR,	MSG_STR_PIPEEQU },
95*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_AER)	MSG_ORIG(MSG_STR_CARATEQU) */
96*0Sstevel@tonic-gate 	{ MSG_STR_AER,	MSG_STR_CARATEQU },
97*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_ALS)	MSG_ORIG(MSG_STR_DBLOPENABKEQU) */
98*0Sstevel@tonic-gate 	{ MSG_STR_ALS,	MSG_STR_DBLOPENABKEQU },
99*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_ARS)	MSG_ORIG(MSG_STR_DBLCLOSABKEQU) */
100*0Sstevel@tonic-gate 	{ MSG_STR_ARS,	MSG_STR_DBLCLOSABKEQU },
101*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_PP)		MSG_ORIG(MSG_STR_DBLPLUS) */
102*0Sstevel@tonic-gate 	{ MSG_STR_PP,	MSG_STR_DBLPLUS },
103*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_MM)		MSG_ORIG(MSG_STR_DBLMINUS) */
104*0Sstevel@tonic-gate 	{ MSG_STR_MM,	MSG_STR_DBLMINUS },
105*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_VC)		MSG_ORIG(MSG_STR_OPENCLOBRAK) */
106*0Sstevel@tonic-gate 	{ MSG_STR_VC,	MSG_STR_OPENCLOBRAK },
107*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_CL)		MSG_ORIG(MSG_STR_OPENCLOSEPAR) */
108*0Sstevel@tonic-gate 	{ MSG_STR_CL,	MSG_STR_OPENCLOSEPAR },
109*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_RF)		MSG_ORIG(MSG_STR_MINUSCLOANGBK) */
110*0Sstevel@tonic-gate 	{ MSG_STR_RF,	MSG_STR_MINUSCLOANGBK },
111*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_EQ)		MSG_ORIG(MSG_STR_DBLEQU) */
112*0Sstevel@tonic-gate 	{ MSG_STR_EQ,	MSG_STR_DBLEQU },
113*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_CO)		MSG_ORIG(MSG_STR_TILDE) */
114*0Sstevel@tonic-gate 	{ MSG_STR_CO,	MSG_STR_TILDE },
115*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_NT)		MSG_ORIG(MSG_STR_BANG) */
116*0Sstevel@tonic-gate 	{ MSG_STR_NT,	MSG_STR_BANG },
117*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_NW)		MSG_ORIG(MSG_STR_NEW) */
118*0Sstevel@tonic-gate 	{ MSG_STR_NW,	MSG_STR_NEW },
119*0Sstevel@tonic-gate 	/* MSG_ORIG(MSG_STR_DL)		MSG_ORIG(MSG_STR_DELETE) */
120*0Sstevel@tonic-gate 	{ MSG_STR_DL,	MSG_STR_DELETE },
121*0Sstevel@tonic-gate 	{ 0,		0 }
122*0Sstevel@tonic-gate };
123*0Sstevel@tonic-gate 
124*0Sstevel@tonic-gate /* This routine demangles an overloaded operator function */
125*0Sstevel@tonic-gate const char *
findop(char * c,int * oplen)126*0Sstevel@tonic-gate findop(char * c, int * oplen)
127*0Sstevel@tonic-gate {
128*0Sstevel@tonic-gate 	register int i, opl;
129*0Sstevel@tonic-gate 
130*0Sstevel@tonic-gate 	for (opl = 0; c[opl] && c[opl] != '_'; opl++)
131*0Sstevel@tonic-gate 		;
132*0Sstevel@tonic-gate 	*oplen = opl;
133*0Sstevel@tonic-gate 
134*0Sstevel@tonic-gate 	for (i = 0; nplist[i].s1; i++) {
135*0Sstevel@tonic-gate 		if (strncmp(MSG_ORIG(nplist[i].s1), c, opl) == 0)
136*0Sstevel@tonic-gate 			return (MSG_ORIG(nplist[i].s2));
137*0Sstevel@tonic-gate 	}
138*0Sstevel@tonic-gate 	return (0);
139*0Sstevel@tonic-gate }
140