static Boolean VarSYSVMatch __P((char *, Boolean, Buffer, ClientData));
static Boolean VarSYSVMatch __P((char *, Boolean, Buffer, void *));
static Var *VarFind __P((char *, GNode *, int));static Var *VarAdd __P((char *, char *, GNode *));static void VarDelete __P((ClientData));static Boolean VarHead __P((char *, Boolean, Buffer, ClientData));static Boolean VarTail __P((char *, Boolean, Buffer, ClientData));static Boolean VarSuffix __P((char *, Boolean, Buffer, ClientData));static Boolean VarRoot __P((char *, Boolean, Buffer, ClientData));static Boolean VarMatch __P((char *, Boolean, Buffer, ClientData));#ifdef SYSVVARSUBstatic Boolean VarSYSVMatch __P((char *, Boolean, Buffer, ClientData));#endifstatic Boolean VarNoMatch __P((char *, Boolean, Buffer, ClientData));#ifndef MAKE_BOOTSTRAPstatic void VarREError __P((int, regex_t *, const char *));static Boolean VarRESubstitute __P((char *, Boolean, Buffer, ClientData));#endifstatic Boolean VarSubstitute __P((char *, Boolean, Buffer, ClientData));static char *VarGetPattern __P((GNode *, int, char **, int, int *, size_t *,				VarPattern *));static char *VarQuote __P((char *));static char *VarModify __P((char *, Boolean (*)(char *, Boolean, Buffer,						ClientData),			    ClientData));static void VarPrintVar __P((ClientData));static Boolean VarUppercase __P((char *word, Boolean addSpace, Buffer buf, ClientData dummy));static Boolean VarLowercase __P((char *word, Boolean addSpace, Buffer buf, ClientData dummy));/*- *----------------------------------------------------------------------- * VarCmp  -- *	See if the given variable matches the named one. Called from *	Lst_Find when searching for a variable of a given name. * * Results: *	0 if they match. non-zero otherwise. * * Side Effects: *	none *----------------------------------------------------------------------- */static intVarCmp (v, name)    ClientData     v;		/* VAR structure to compare */    ClientData     name;	/* name to look for */{    return (strcmp ((char *) name, ((Var *) v)->name));}/*- *----------------------------------------------------------------------- * VarFind -- *	Find the given variable in the given context and any other contexts *	indicated. * * Results: *	A pointer to the structure describing the desired variable or *	NULL if the variable does not exist. * * Side Effects: *	Caches env variables in the VAR_ENV context. *----------------------------------------------------------------------- */static Var *VarFind (name, ctxt, flags)    char           	*name;	/* name to find */    GNode          	*ctxt;	/* context in which to find it */    int             	flags;	/* FIND_GLOBAL set means to look in the				 * VAR_GLOBAL context as well.				 * FIND_CMD set means to look in the VAR_CMD				 * context also.				 * FIND_ENV set means to look in the				 * environment/VAR_ENV context.  */{    LstNode         	var;    Var		  	*v;	/*	 * If the variable name begins with a '.', it could very well be one of	 * the local ones.  We check the name against all the local variables	 * and substitute the short version in for 'name' if it matches one of	 * them.	 */	if (*name == '.' && isupper((unsigned char) name[1]))		switch (name[1]) {		case 'A':			if (!strcmp(name, ".ALLSRC"))				name = ALLSRC;			if (!strcmp(name, ".ARCHIVE"))				name = ARCHIVE;			break;		case 'I':			if (!strcmp(name, ".IMPSRC"))				name = IMPSRC;			break;		case 'M':			if (!strcmp(name, ".MEMBER"))				name = MEMBER;			break;		case 'O':			if (!strcmp(name, ".OODATE"))				name = OODATE;			break;		case 'P':			if (!strcmp(name, ".PREFIX"))				name = PREFIX;			break;		case 'T':			if (!strcmp(name, ".TARGET"))				name = TARGET;			break;		}    /*     * First look for the variable in the given context. If it's not there,     * look for it in VAR_CMD, VAR_GLOBAL and the environment, in that order,     * depending on the FIND_* flags in 'flags'     */    var = Lst_Find(ctxt->context, VarCmp, name);    if ((var == NULL) && (flags & FIND_CMD) && (ctxt != VAR_CMD))	var = Lst_Find(VAR_CMD->context, VarCmp, name);    if (!checkEnvFirst && (var == NULL) && (flags & FIND_GLOBAL) &&	(ctxt != VAR_GLOBAL)) {	var = Lst_Find(VAR_GLOBAL->context, VarCmp, name);    }    if ((var == NULL) && (flags & FIND_ENV)) {    	var = Lst_Find(VAR_ENV->context, VarCmp, name);	if (var == NULL) {	    char *env;	    if ((env = getenv(name)) != NULL)	    	return VarAdd(name, env, VAR_ENV);	}    }    if (var == NULL && checkEnvFirst && (flags & FIND_GLOBAL) &&		   (ctxt != VAR_GLOBAL)) 	    var = Lst_Find(VAR_GLOBAL->context, VarCmp, name);    if (var == NULL)	return NULL;    else 	return (Var *)Lst_Datum(var);}