rem: str = (select & SEL_REPLACE) ? &rpl_ldflags : &prm_ldflags;
add: if (select & SEL_REPLACE) str = &rpl_ldflags; else { str = &prm_ldflags; rpl_ldflags = 0; }
context: ld_generic_env(const char *s1, size_t len, const char *s2, Word *lmflags,    Word *lmtflags, uint_t env_flags, int aout){	u_longlong_t	variable = 0;	unsigned short	select = 0;	const char **str;	Word val = 0;	/*	 * Determine whether we're dealing with a replaceable or permanent	 * string.	 */	if (env_flags & ENV_TYP_PERMANT) {		/*		 * If the string is from a configuration file and defined as		 * permanent, assign it as permanent.		 */		select |= SEL_PERMANT;	} else		select |= SEL_REPLACE;	/*	 * Parse the variable given.	 *	 * The LD_AUDIT family.	 */	if (*s1 == 'A') {		if ((len == MSG_LD_AUDIT_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_AUDIT), MSG_LD_AUDIT_SIZE) == 0)) {			/*			 * Replaceable and permanent audit objects can exist.			 */			select |= SEL_ACT_STR;			str = (select & SEL_REPLACE) ? &rpl_audit : &prm_audit;			variable = ENV_FLG_AUDIT;		} else if ((len == MSG_LD_AUDIT_ARGS_SIZE) &&		    (strncmp(s1, MSG_ORIG(MSG_LD_AUDIT_ARGS),		    MSG_LD_AUDIT_ARGS_SIZE) == 0)) {			/*			 * A specialized variable for plt_exit() use, not			 * documented for general use.			 */			select |= SEL_ACT_SPEC_2;			variable = ENV_FLG_AUDIT_ARGS;		}	}	/*	 * The LD_BIND family and LD_BREADTH (historic).	 */	else if (*s1 == 'B') {		if ((len == MSG_LD_BIND_LAZY_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_BIND_LAZY),		    MSG_LD_BIND_LAZY_SIZE) == 0)) {			select |= SEL_ACT_RT2;			val = RT_FL2_BINDLAZY;			variable = ENV_FLG_BIND_LAZY;		} else if ((len == MSG_LD_BIND_NOW_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_BIND_NOW), MSG_LD_BIND_NOW_SIZE) == 0)) {			select |= SEL_ACT_RT2;			val = RT_FL2_BINDNOW;			variable = ENV_FLG_BIND_NOW;		} else if ((len == MSG_LD_BIND_NOT_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_BIND_NOT), MSG_LD_BIND_NOT_SIZE) == 0)) {			/*			 * Another trick, enabled to help debug AOUT			 * applications under BCP, but not documented for			 * general use.			 */			select |= SEL_ACT_RT;			val = RT_FL_NOBIND;			variable = ENV_FLG_BIND_NOT;		} else if ((len == MSG_LD_BINDINGS_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_BINDINGS), MSG_LD_BINDINGS_SIZE) == 0)) {			/*			 * This variable is simply for backward compatibility.			 * If this and LD_DEBUG are both specified, only one of			 * the strings is going to get processed.			 */			select |= SEL_ACT_SPEC_2;			variable = ENV_FLG_BINDINGS;#ifndef LD_BREADTH_DISABLED		} else if ((len == MSG_LD_BREADTH_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_BREADTH), MSG_LD_BREADTH_SIZE) == 0)) {			/*			 * Besides some old patches this is no longer available.			 */			rtld_flags |= RT_FL_BREADTH;			return;#endif		}	}	/*	 * LD_CONCURRENCY and LD_CONFIG family.	 */	else if (*s1 == 'C') {		if ((len == MSG_LD_CONCURRENCY_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_CONCURRENCY),		    MSG_LD_CONCURRENCY_SIZE) == 0)) {			/*			 * Waiting in the wings, as concurrency checking isn't			 * yet enabled.			 */			select |= SEL_ACT_SPEC_2;			variable = ENV_FLG_CONCURRENCY;		} else if ((len == MSG_LD_CONFGEN_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_CONFGEN), MSG_LD_CONFGEN_SIZE) == 0)) {			/*			 * Set by crle(1) to indicate it's building a			 * configuration file, not documented for general use.			 */			select |= SEL_ACT_SPEC_2;			variable = ENV_FLG_CONFGEN;		} else if ((len == MSG_LD_CONFIG_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_CONFIG), MSG_LD_CONFIG_SIZE) == 0)) {			/*			 * Secure applications must use a default configuration			 * file.  A setting from a configuration file doesn't			 * make sense (given we must be reading a configuration			 * file to have gotten this).			 */			if ((rtld_flags & RT_FL_SECURE) ||			    (env_flags & ENV_TYP_CONFIG))				return;			select |= SEL_ACT_STR;			str = &config->c_name;			variable = ENV_FLG_CONFIG;		}	}	/*	 * The LD_DEBUG family and LD_DEMANGLE.	 */	else if (*s1 == 'D') {		if ((len == MSG_LD_DEBUG_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_DEBUG), MSG_LD_DEBUG_SIZE) == 0)) {			select |= SEL_ACT_STR;			str = (select & SEL_REPLACE) ? &rpl_debug : &prm_debug;			variable = ENV_FLG_DEBUG;		} else if ((len == MSG_LD_DEBUG_OUTPUT_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_DEBUG_OUTPUT),		    MSG_LD_DEBUG_OUTPUT_SIZE) == 0)) {			select |= SEL_ACT_STR;			str = &dbg_file;			variable = ENV_FLG_DEBUG_OUTPUT;		} else if ((len == MSG_LD_DEMANGLE_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_DEMANGLE), MSG_LD_DEMANGLE_SIZE) == 0)) {			select |= SEL_ACT_RT;			val = RT_FL_DEMANGLE;			variable = ENV_FLG_DEMANGLE;		}	}	/*	 * LD_FLAGS - collect the best variable definition.  On completion of	 * environment variable processing pass the result to ld_flags_env()	 * where they'll be decomposed and passed back to this routine.	 */	else if (*s1 == 'F') {		if ((len == MSG_LD_FLAGS_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_FLAGS), MSG_LD_FLAGS_SIZE) == 0)) {			select |= SEL_ACT_SPEC_1;			str =			(select & SEL_REPLACE) ? &rpl_ldflags : &prm_ldflags;			variable = ENV_FLG_FLAGS;		}	}	/*	 * LD_INIT (internal, used by ldd(1)).	 */	else if (*s1 == 'I') {		if ((len == MSG_LD_INIT_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_INIT), MSG_LD_INIT_SIZE) == 0)) {			select |= SEL_ACT_LML;			val = LML_FLG_TRC_INIT;			variable = ENV_FLG_INIT;		}	}	/*	 * The LD_LIBRARY_PATH and LD_LOAD families.	 */	else if (*s1 == 'L') {		if ((len == MSG_LD_LIBPATH_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_LIBPATH), MSG_LD_LIBPATH_SIZE) == 0)) {			select |= SEL_ACT_SPEC_1;			str =			(select & SEL_REPLACE) ? &rpl_libpath : &prm_libpath;			variable = ENV_FLG_LIBPATH;		} else if ((len == MSG_LD_LOADAVAIL_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_LOADAVAIL), MSG_LD_LOADAVAIL_SIZE) == 0)) {			/*			 * Internal use by crle(1), not documented for general			 * use.			 */			select |= SEL_ACT_LML;			val = LML_FLG_LOADAVAIL;			variable = ENV_FLG_LOADAVAIL;		} else if ((len == MSG_LD_LOADFLTR_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_LOADFLTR), MSG_LD_LOADFLTR_SIZE) == 0)) {			select |= SEL_ACT_SPEC_2;			variable = ENV_FLG_LOADFLTR;		}	}	/*	 * The LD_NO family.	 */	else if (*s1 == 'N') {		if ((len == MSG_LD_NOAUDIT_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_NOAUDIT), MSG_LD_NOAUDIT_SIZE) == 0)) {			select |= SEL_ACT_RT;			val = RT_FL_NOAUDIT;			variable = ENV_FLG_NOAUDIT;		} else if ((len == MSG_LD_NOAUXFLTR_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_NOAUXFLTR), MSG_LD_NOAUXFLTR_SIZE) == 0)) {			select |= SEL_ACT_RT;			val = RT_FL_NOAUXFLTR;			variable = ENV_FLG_NOAUXFLTR;		} else if ((len == MSG_LD_NOBAPLT_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_NOBAPLT), MSG_LD_NOBAPLT_SIZE) == 0)) {			select |= SEL_ACT_RT;			val = RT_FL_NOBAPLT;			variable = ENV_FLG_NOBAPLT;		} else if ((len == MSG_LD_NOCONFIG_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_NOCONFIG), MSG_LD_NOCONFIG_SIZE) == 0)) {			select |= SEL_ACT_RT;			val = RT_FL_NOCFG;			variable = ENV_FLG_NOCONFIG;		} else if ((len == MSG_LD_NODIRCONFIG_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_NODIRCONFIG),		    MSG_LD_NODIRCONFIG_SIZE) == 0)) {			select |= SEL_ACT_RT;			val = RT_FL_NODIRCFG;			variable = ENV_FLG_NODIRCONFIG;		} else if ((len == MSG_LD_NODIRECT_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_NODIRECT), MSG_LD_NODIRECT_SIZE) == 0)) {			select |= SEL_ACT_LMLT;			val = LML_TFLG_NODIRECT;			variable = ENV_FLG_NODIRECT;		} else if ((len == MSG_LD_NOENVCONFIG_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_NOENVCONFIG),		    MSG_LD_NOENVCONFIG_SIZE) == 0)) {			select |= SEL_ACT_RT;			val = RT_FL_NOENVCFG;			variable = ENV_FLG_NOENVCONFIG;		} else if ((len == MSG_LD_NOFLTCONFIG_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_NOFLTCONFIG),		    MSG_LD_NOFLTCONFIG_SIZE) == 0)) {			select |= SEL_ACT_RT2;			val = RT_FL2_NOFLTCFG;			variable = ENV_FLG_NOFLTCONFIG;		} else if ((len == MSG_LD_NOLAZY_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_NOLAZY), MSG_LD_NOLAZY_SIZE) == 0)) {			select |= SEL_ACT_LMLT;			val = LML_TFLG_NOLAZYLD;			variable = ENV_FLG_NOLAZY;		} else if ((len == MSG_LD_NOOBJALTER_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_NOOBJALTER),		    MSG_LD_NOOBJALTER_SIZE) == 0)) {			select |= SEL_ACT_RT;			val = RT_FL_NOOBJALT;			variable = ENV_FLG_NOOBJALTER;		} else if ((len == MSG_LD_NOVERSION_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_NOVERSION), MSG_LD_NOVERSION_SIZE) == 0)) {			select |= SEL_ACT_RT;			val = RT_FL_NOVERSION;			variable = ENV_FLG_NOVERSION;		}	}	/*	 * LD_ORIGIN.	 */	else if (*s1 == 'O') {#ifndef	EXPAND_RELATIVE		if ((len == MSG_LD_ORIGIN_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_ORIGIN), MSG_LD_ORIGIN_SIZE) == 0)) {			/*			 * Besides some old patches this is no longer required.			 */			rtld_flags |= RT_FL_RELATIVE;		}#endif		return;	}	/*	 * LD_PRELOAD and LD_PROFILE family.	 */	else if (*s1 == 'P') {		if ((len == MSG_LD_PRELOAD_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_PRELOAD), MSG_LD_PRELOAD_SIZE) == 0)) {			select |= SEL_ACT_STR;			str =			(select & SEL_REPLACE) ? &rpl_preload : &prm_preload;			variable = ENV_FLG_PRELOAD;		} else if ((len == MSG_LD_PROFILE_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_PROFILE), MSG_LD_PROFILE_SIZE) == 0)) {			/*			 * Only one user library can be profiled at a time.			 */			select |= SEL_ACT_SPEC_2;			variable = ENV_FLG_PROFILE;		} else if ((len == MSG_LD_PROFILE_OUTPUT_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_PROFILE_OUTPUT),		    MSG_LD_PROFILE_OUTPUT_SIZE) == 0)) {			/*			 * Only one user library can be profiled at a time.			 */			select |= SEL_ACT_STR;			str = &profile_out;			variable = ENV_FLG_PROFILE_OUTPUT;		}	}	/*	 * LD_SIGNAL.	 */	else if (*s1 == 'S') {		if (rtld_flags & RT_FL_SECURE)			return;		if ((len == MSG_LD_SIGNAL_SIZE) &&		    (strncmp(s1, MSG_ORIG(MSG_LD_SIGNAL),		    MSG_LD_SIGNAL_SIZE) == 0)) {			select |= SEL_ACT_SPEC_2;			variable = ENV_FLG_SIGNAL;		}	}	/*	 * The LD_TRACE family (internal, used by ldd(1)).	 */	else if (*s1 == 'T') {		if (((len == MSG_LD_TRACE_OBJS_SIZE) &&		    (strncmp(s1, MSG_ORIG(MSG_LD_TRACE_OBJS),		    MSG_LD_TRACE_OBJS_SIZE) == 0)) ||		    ((len == MSG_LD_TRACE_OBJS_E_SIZE) &&		    (((strncmp(s1, MSG_ORIG(MSG_LD_TRACE_OBJS_E),		    MSG_LD_TRACE_OBJS_E_SIZE) == 0) && !aout) ||		    ((strncmp(s1, MSG_ORIG(MSG_LD_TRACE_OBJS_A),		    MSG_LD_TRACE_OBJS_A_SIZE) == 0) && aout)))) {			select |= SEL_ACT_SPEC_2;			variable = ENV_FLG_TRACE_OBJS;		} else if ((len == MSG_LD_TRACE_PTHS_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_TRACE_PTHS),		    MSG_LD_TRACE_PTHS_SIZE) == 0)) {			select |= SEL_ACT_LML;			val = LML_FLG_TRC_SEARCH;			variable = ENV_FLG_TRACE_PTHS;		}	}	/*	 * LD_UNREF and LD_UNUSED (internal, used by ldd(1)).	 */	else if (*s1 == 'U') {		if ((len == MSG_LD_UNREF_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_UNREF), MSG_LD_UNREF_SIZE) == 0)) {			select |= SEL_ACT_LML;			val = LML_FLG_TRC_UNREF;			variable = ENV_FLG_UNREF;		} else if ((len == MSG_LD_UNUSED_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_UNUSED), MSG_LD_UNUSED_SIZE) == 0)) {			select |= SEL_ACT_LML;			val = LML_FLG_TRC_UNUSED;			variable = ENV_FLG_UNUSED;		}	}	/*	 * LD_VERBOSE (internal, used by ldd(1)).	 */	else if (*s1 == 'V') {		if ((len == MSG_LD_VERBOSE_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_VERBOSE), MSG_LD_VERBOSE_SIZE) == 0)) {			select |= SEL_ACT_LML;			val = LML_FLG_TRC_VERBOSE;			variable = ENV_FLG_VERBOSE;		}	}	/*	 * LD_WARN (internal, used by ldd(1)).	 */	else if (*s1 == 'W') {		if ((len == MSG_LD_WARN_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_WARN), MSG_LD_WARN_SIZE) == 0)) {			select |= SEL_ACT_LML;			val = LML_FLG_TRC_WARN;			variable = ENV_FLG_WARN;		}#ifdef	SIEBEL_DISABLE	}	/*	 * LD__FIX__ (undocumented, enable future technology that can't be	 * delivered in a patch release).	 */	else if (*s1 == '_') {		if ((len == MSG_LD_FIX_1_SIZE) && (strncmp(s1,		    MSG_ORIG(MSG_LD_FIX_1), MSG_LD_FIX_1_SIZE) == 0)) {			select |= SEL_ACT_RT;			val = RT_FL_DISFIX_1;			variable = ENV_FLG_FIX_1;		}#endif	}	if (variable == 0)		return;	/*	 * If the variable is already processed with ISA specific variable,	 * no further processing needed.	 */	if (((select & SEL_REPLACE) && (rplisa & variable)) ||	    ((select & SEL_PERMANT) && (prmisa & variable)))		return;	/*	 * Now mark the appropriate variables	 */	if (env_flags & ENV_TYP_ISA) {		/*		 * This is ISA setting. We do the setting		 * even if s2 is NULL.		 * If s2 is NULL, we might need to undo		 * the setting.		 */		if (select & SEL_REPLACE) {			rplisa |= variable;		} else {			prmisa |= variable;		}	} else if (s2) {		/*		 * This is non0-ISA setting		 */		if (select & SEL_REPLACE) {			rplgen |= variable;		} else			prmgen |= variable;	} else		/*		 * This is non-ISA setting which		 * can be ignored.		 */		return;	/*	 * Now perform the setting.	 */	if (select & SEL_ACT_RT) {		if (s2)			rtld_flags |= val;		else			rtld_flags &= ~val;	} else if (select & SEL_ACT_RT2) {		if (s2)			rtld_flags2 |= val;		else			rtld_flags2 &= ~val;	} else if (select & SEL_ACT_STR)		*str = s2;	else if (select & SEL_ACT_LML) {		if (s2)			*lmflags |= val;		else			*lmflags &= ~val;	} else if (select & SEL_ACT_LMLT) {		if (s2)			*lmtflags |= val;		else			*lmtflags &= ~val;	} else if (select & SEL_ACT_SPEC_1) {		/*		 * variable is either ENV_FLG_FLAGS or ENV_FLG_LIBPATH		 */		*str = s2;		if ((select & SEL_REPLACE) && (env_flags & ENV_TYP_CONFIG)) {			if (s2) {				if (variable == ENV_FLG_FLAGS)					env_info |= ENV_INF_FLAGCFG;				else					env_info |= ENV_INF_PATHCFG;			} else {				if (variable == ENV_FLG_FLAGS)					env_info &= ~ENV_INF_FLAGCFG;				else					env_info &= ~ENV_INF_PATHCFG;			}		}	} else if (select & SEL_ACT_SPEC_2) {		/*		 * variables can be: ENV_FLG_		 * 	AUDIT_ARGS, BINDING, CONCURRENCY, CONFGEN,		 *	LOADFLTR, PROFILE, SIGNAL, TRACE_OBJS		 */		if (variable == ENV_FLG_AUDIT_ARGS) {			if (s2) {				audit_argcnt = atoi(s2);				audit_argcnt += audit_argcnt % 2;			} else				audit_argcnt = 0;		} else if (variable == ENV_FLG_BINDINGS) {			if (s2)				rpl_debug = MSG_ORIG(MSG_TKN_BINDINGS);			else				rpl_debug = 0;		} else if (variable == ENV_FLG_CONCURRENCY) {			if (s2)				rtld_flags &= ~RT_FL_NOCONCUR;			else				rtld_flags |= RT_FL_NOCONCUR;		} else if (variable == ENV_FLG_CONFGEN) {			if (s2) {				rtld_flags |= RT_FL_CONFGEN;				*lmflags |= LML_FLG_IGNRELERR;			} else {				rtld_flags &= ~RT_FL_CONFGEN;				*lmflags &= ~LML_FLG_IGNRELERR;			}		} else if (variable == ENV_FLG_LOADFLTR) {			if (s2) {				*lmtflags |= LML_TFLG_LOADFLTR;				if (*s2 == '2')					rtld_flags |= RT_FL_WARNFLTR;			} else {				*lmtflags &= ~LML_TFLG_LOADFLTR;				rtld_flags &= ~RT_FL_WARNFLTR;			}		} else if (variable == ENV_FLG_PROFILE) {			profile_name = s2;			if (s2) {				if (strcmp(s2, MSG_ORIG(MSG_FIL_RTLD)) == 0) {					return;				}				if (rtld_flags & RT_FL_SECURE) {					profile_lib =#if	defined(_ELF64)					    MSG_ORIG(MSG_PTH_LDPROFSE_64);#else					    MSG_ORIG(MSG_PTH_LDPROFSE);#endif				} else {					profile_lib =#if	defined(_ELF64)					    MSG_ORIG(MSG_PTH_LDPROF_64);#else					    MSG_ORIG(MSG_PTH_LDPROF);#endif				}			} else				profile_lib = 0;		} else if (variable == ENV_FLG_SIGNAL) {			killsig = s2 ? atoi(s2) : SIGKILL;		} else if (variable == ENV_FLG_TRACE_OBJS) {			if (s2) {				*lmflags |= LML_FLG_TRC_ENABLE;				if (*s2 == '2')					*lmflags |= LML_FLG_TRC_LDDSTUB;			} else				*lmflags &=				~(LML_FLG_TRC_ENABLE|LML_FLG_TRC_LDDSTUB);		}	}}