/*****************************************************************************

	ExeUnd()

	This function executes an underscore (_) command.

*****************************************************************************/

#include "ZPort.h"		/* define portability identifiers */
#include "DefError.h"		/* define identifiers for error messages */
#include "DefTeco.h"		/* define general identifiers */

extern	VOID	ErrMsg();	/* display an error message */
extern	DEFAULT	Search();	/* top level search */

EXTERN	BYTE	CmdMod;		/* command modifiers flags for @, :, etc. */
EXTERN	WORD	SrcTyp;		/* type of search (E_SEARCH, N_SEARCH, etc) */


DEFAULT ExeUnd()		/* execute a _ (underscore) command */
{
#if DEBUGGING
DbgInd+=2;if(DbgLvl>=1){DbgMsg();DbgDBf("ExeUnd: called.\015\012");DbgROf();}
#endif

/* The command m,n_ is illegal: the user should use m,nFB */

	if (CmdMod & MARGIS)			/* if it's m,n_ */
		{
		ErrMsg(ERR_ILL, "m,n_");	/* illegal command "m,n_" */
#if DEBUGGING
if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeUnd: returning FAILURE.\015\012");DbgROf();}DbgInd-=2;
#endif
		return(FAILURE);
		}

	if (CmdMod & DCOLON)			/* if it's ::_ */
		{
		ErrMsg(ERR_ILL, "::_");		/* illegal command "::_" */
#if DEBUGGING
if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeUnd: returning FAILURE.\015\012");DbgROf();}DbgInd-=2;
#endif
		return(FAILURE);
		}

	SrcTyp = U_SEARCH;
	if (Search(NO) == FAILURE)
#if DEBUGGING
{if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeUnd: returning FAILURE.\015\012");DbgROf();}DbgInd-=2;
#endif
		return(FAILURE);
#if DEBUGGING
}
#endif

	CmdMod = '\0';				/* clear modifiers flags */
#if DEBUGGING
if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeUnd: returning SUCCESS.\015\012");DbgROf();}DbgInd-=2;
#endif
	return(SUCCESS);
}
