17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bdstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bdstevel@tonic-gate * (the "License").  You may not use this file except in compliance
77c478bdstevel@tonic-gate * with the License.
87c478bdstevel@tonic-gate *
97c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bdstevel@tonic-gate * See the License for the specific language governing permissions
127c478bdstevel@tonic-gate * and limitations under the License.
137c478bdstevel@tonic-gate *
147c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bdstevel@tonic-gate *
207c478bdstevel@tonic-gate * CDDL HEADER END
217c478bdstevel@tonic-gate */
227c478bdstevel@tonic-gate/*
237c478bdstevel@tonic-gate *	Copyright (c) 1988 AT&T
247c478bdstevel@tonic-gate *	  All Rights Reserved
257c478bdstevel@tonic-gate *
267c478bdstevel@tonic-gate *
277c478bdstevel@tonic-gate *	Copyright (c) 1999 by Sun Microsystems, Inc.
287c478bdstevel@tonic-gate *	All rights reserved.
297c478bdstevel@tonic-gate */
307c478bdstevel@tonic-gate#pragma ident	"%Z%%M%	%I%	%E% SMI" 	/* SVr4.0 1.2	*/
317c478bdstevel@tonic-gate
327c478bdstevel@tonic-gate#include	"elf_dem.h"
337c478bdstevel@tonic-gate#include	<string.h>
347c478bdstevel@tonic-gate#include	"msg.h"
357c478bdstevel@tonic-gate
367c478bdstevel@tonic-gatestruct name_pair {
377c478bdstevel@tonic-gate#ifdef __lint
387c478bdstevel@tonic-gate	char	* s1, * s2;
397c478bdstevel@tonic-gate#else
407c478bdstevel@tonic-gate	int	s1, s2;
417c478bdstevel@tonic-gate#endif
427c478bdstevel@tonic-gate};
437c478bdstevel@tonic-gate
447c478bdstevel@tonic-gatestruct name_pair nplist[100] = {
457c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_LT)		MSG_ORIG(MSG_STR_OPNANGBRAK) */
467c478bdstevel@tonic-gate	{ MSG_STR_LT,	MSG_STR_OPNANGBRAK },
477c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_LS)		MSG_ORIG(MSG_STR_DBLOPNANGBRAK) */
487c478bdstevel@tonic-gate	{ MSG_STR_LS,	MSG_STR_DBLOPNANGBRAK },
497c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_DV)		MSG_ORIG(MSG_STR_SLASH) */
507c478bdstevel@tonic-gate	{ MSG_STR_DV,	MSG_STR_SLASH },
517c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_GT)		MSG_ORIG(MSG_STR_CLOANGBRAK) */
527c478bdstevel@tonic-gate	{ MSG_STR_GT,	MSG_STR_CLOANGBRAK },
537c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_RS)		MSG_ORIG(MSG_STR_DBLCLOANGBRAK) */
547c478bdstevel@tonic-gate	{ MSG_STR_RS,	MSG_STR_DBLCLOANGBRAK },
557c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_MD)		MSG_ORIG(MSG_STR_PERCENT) */
567c478bdstevel@tonic-gate	{ MSG_STR_MD,	MSG_STR_PERCENT },
577c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_LE)		MSG_ORIG(MSG_STR_OPNANGBRAKEQU) */
587c478bdstevel@tonic-gate	{ MSG_STR_LE,	MSG_STR_OPNANGBRAKEQU },
597c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_ML)		MSG_ORIG(MSG_STR_STAR) */
607c478bdstevel@tonic-gate	{ MSG_STR_ML,	MSG_STR_STAR },
617c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_PL)		MSG_ORIG(MSG_STR_PLUS) */
627c478bdstevel@tonic-gate	{ MSG_STR_PL,	MSG_STR_PLUS },
637c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_GE)		MSG_ORIG(MSG_STR_CLOANGBRAKEQU) */
647c478bdstevel@tonic-gate	{ MSG_STR_GE,	MSG_STR_CLOANGBRAKEQU },
657c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_AD)		MSG_ORIG(MSG_STR_AMP) */
667c478bdstevel@tonic-gate	{ MSG_STR_AD,	MSG_STR_AMP },
677c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_MI)		MSG_ORIG(MSG_STR_MINUS) */
687c478bdstevel@tonic-gate	{ MSG_STR_MI,	MSG_STR_MINUS },
697c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_NE)		MSG_ORIG(MSG_STR_BANGEQU) */
707c478bdstevel@tonic-gate	{ MSG_STR_NE,	MSG_STR_BANGEQU },
717c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_OR)		MSG_ORIG(MSG_STR_PIPE) */
727c478bdstevel@tonic-gate	{ MSG_STR_OR,	MSG_STR_PIPE },
737c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_ER)		MSG_ORIG(MSG_STR_CARAT) */
747c478bdstevel@tonic-gate	{ MSG_STR_ER,	MSG_STR_CARAT },
757c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_AA)		MSG_ORIG(MSG_STR_DBLAMP) */
767c478bdstevel@tonic-gate	{ MSG_STR_AA,	MSG_STR_DBLAMP },
777c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_OO)		MSG_ORIG(MSG_STR_DBLPIPE) */
787c478bdstevel@tonic-gate	{ MSG_STR_OO,	MSG_STR_DBLPIPE },
797c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_AS)		MSG_ORIG(MSG_STR_EQU) */
807c478bdstevel@tonic-gate	{ MSG_STR_AS,	MSG_STR_EQU },
817c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_APL)	MSG_ORIG(MSG_STR_PLUSEQU) */
827c478bdstevel@tonic-gate	{ MSG_STR_APL,	MSG_STR_PLUSEQU },
837c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_AMI)	MSG_ORIG(MSG_STR_MINUSEQU) */
847c478bdstevel@tonic-gate	{ MSG_STR_AMI,	MSG_STR_MINUSEQU },
857c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_AMU)	MSG_ORIG(MSG_STR_STARTEQU) */
867c478bdstevel@tonic-gate	{ MSG_STR_AMU,	MSG_STR_STARTEQU },
877c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_ADV)	MSG_ORIG(MSG_STR_SLASHEQU) */
887c478bdstevel@tonic-gate	{ MSG_STR_ADV,	MSG_STR_SLASHEQU },
897c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_AMD)	MSG_ORIG(MSG_STR_PERCENTEQU) */
907c478bdstevel@tonic-gate	{ MSG_STR_AMD,	MSG_STR_PERCENTEQU },
917c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_AAD)	MSG_ORIG(MSG_STR_AMPEQU) */
927c478bdstevel@tonic-gate	{ MSG_STR_AAD,	MSG_STR_AMPEQU },
937c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_AOR)	MSG_ORIG(MSG_STR_PIPEEQU) */
947c478bdstevel@tonic-gate	{ MSG_STR_AOR,	MSG_STR_PIPEEQU },
957c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_AER)	MSG_ORIG(MSG_STR_CARATEQU) */
967c478bdstevel@tonic-gate	{ MSG_STR_AER,	MSG_STR_CARATEQU },
977c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_ALS)	MSG_ORIG(MSG_STR_DBLOPENABKEQU) */
987c478bdstevel@tonic-gate	{ MSG_STR_ALS,	MSG_STR_DBLOPENABKEQU },
997c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_ARS)	MSG_ORIG(MSG_STR_DBLCLOSABKEQU) */
1007c478bdstevel@tonic-gate	{ MSG_STR_ARS,	MSG_STR_DBLCLOSABKEQU },
1017c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_PP)		MSG_ORIG(MSG_STR_DBLPLUS) */
1027c478bdstevel@tonic-gate	{ MSG_STR_PP,	MSG_STR_DBLPLUS },
1037c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_MM)		MSG_ORIG(MSG_STR_DBLMINUS) */
1047c478bdstevel@tonic-gate	{ MSG_STR_MM,	MSG_STR_DBLMINUS },
1057c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_VC)		MSG_ORIG(MSG_STR_OPENCLOBRAK) */
1067c478bdstevel@tonic-gate	{ MSG_STR_VC,	MSG_STR_OPENCLOBRAK },
1077c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_CL)		MSG_ORIG(MSG_STR_OPENCLOSEPAR) */
1087c478bdstevel@tonic-gate	{ MSG_STR_CL,	MSG_STR_OPENCLOSEPAR },
1097c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_RF)		MSG_ORIG(MSG_STR_MINUSCLOANGBK) */
1107c478bdstevel@tonic-gate	{ MSG_STR_RF,	MSG_STR_MINUSCLOANGBK },
1117c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_EQ)		MSG_ORIG(MSG_STR_DBLEQU) */
1127c478bdstevel@tonic-gate	{ MSG_STR_EQ,	MSG_STR_DBLEQU },
1137c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_CO)		MSG_ORIG(MSG_STR_TILDE) */
1147c478bdstevel@tonic-gate	{ MSG_STR_CO,	MSG_STR_TILDE },
1157c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_NT)		MSG_ORIG(MSG_STR_BANG) */
1167c478bdstevel@tonic-gate	{ MSG_STR_NT,	MSG_STR_BANG },
1177c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_NW)		MSG_ORIG(MSG_STR_NEW) */
1187c478bdstevel@tonic-gate	{ MSG_STR_NW,	MSG_STR_NEW },
1197c478bdstevel@tonic-gate	/* MSG_ORIG(MSG_STR_DL)		MSG_ORIG(MSG_STR_DELETE) */
1207c478bdstevel@tonic-gate	{ MSG_STR_DL,	MSG_STR_DELETE },
1217c478bdstevel@tonic-gate	{ 0,		0 }
1227c478bdstevel@tonic-gate};
1237c478bdstevel@tonic-gate
1247c478bdstevel@tonic-gate/* This routine demangles an overloaded operator function */
1257c478bdstevel@tonic-gateconst char *
1267c478bdstevel@tonic-gatefindop(char * c, int * oplen)
1277c478bdstevel@tonic-gate{
1287c478bdstevel@tonic-gate	register int i, opl;
1297c478bdstevel@tonic-gate
1307c478bdstevel@tonic-gate	for (opl = 0; c[opl] && c[opl] != '_'; opl++)
1317c478bdstevel@tonic-gate		;
1327c478bdstevel@tonic-gate	*oplen = opl;
1337c478bdstevel@tonic-gate
1347c478bdstevel@tonic-gate	for (i = 0; nplist[i].s1; i++) {
1357c478bdstevel@tonic-gate		if (strncmp(MSG_ORIG(nplist[i].s1), c, opl) == 0)
1367c478bdstevel@tonic-gate			return (MSG_ORIG(nplist[i].s2));
1377c478bdstevel@tonic-gate	}
1387c478bdstevel@tonic-gate	return (0);
1397c478bdstevel@tonic-gate}
140