free(rwbuf);
sm_free(rwbuf);
map_lookup(smap, key, argvect, pstat, e)	STAB *smap;	char key[];	char **argvect;	int *pstat;	ENVELOPE *e;{	auto int status = EX_OK;	MAP *map;	char *replac;	if (smap == NULL)		return NULL;	map = &smap->s_map;	DYNOPENMAP(map);	if (e->e_sendmode == SM_DEFER &&	    bitset(MF_DEFER, map->map_mflags))	{		/* don't do any map lookups */		if (tTd(60, 1))			dprintf("map_lookup(%s, %s) => DEFERRED\n",				smap->s_name, key);		*pstat = EX_TEMPFAIL;		return NULL;	}	if (!bitset(MF_KEEPQUOTES, map->map_mflags))		stripquotes(key);	if (tTd(60, 1))	{		dprintf("map_lookup(%s, %s", smap->s_name, key);		if (tTd(60, 5))		{			int i;			for (i = 0; argvect[i] != NULL; i++)				dprintf(", %%%d=%s", i, argvect[i]);		}		dprintf(") => ");	}	replac = (*map->map_class->map_lookup)(map, key, argvect, &status);	if (tTd(60, 1))		dprintf("%s (%d)\n",			replac != NULL ? replac : "NOT FOUND",			status);	/* should recover if status == EX_TEMPFAIL */	if (status == EX_TEMPFAIL && !bitset(MF_NODEFER, map->map_mflags))	{		*pstat = EX_TEMPFAIL;		if (tTd(60, 1))			dprintf("map_lookup(%s, %s) tempfail: errno=%d\n",				smap->s_name, key, errno);		if (e->e_message == NULL)		{			char mbuf[320];			snprintf(mbuf, sizeof mbuf,				"%.80s map: lookup (%s): deferred",				smap->s_name,				shortenstring(key, MAXSHORTSTR));			e->e_message = newstr(mbuf);		}	}	if (status == EX_TEMPFAIL && map->map_tapp != NULL)	{		size_t i = strlen(key) + strlen(map->map_tapp) + 1;		static char *rwbuf = NULL;		static size_t rwbuflen = 0;		if (i > rwbuflen)		{			if (rwbuf != NULL)				free(rwbuf);			rwbuflen = i;			rwbuf = (char *) xalloc(rwbuflen);		}		snprintf(rwbuf, rwbuflen, "%s%s", key, map->map_tapp);		if (tTd(60, 4))			dprintf("map_lookup tempfail: returning \"%s\"\n",				rwbuf);		return rwbuf;	}	return replac;}