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

	FlowEC()

	This function moves the command string pointer to the next matching
' character in the command string.  It is called when a F' command is
encountered or when a | character is encountered while a conditional command
string is executing.

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

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

extern	VOID	EchoIt();	/* echo a character to the terminal */
extern	VOID	ErrMsg();	/* display an error message */
extern	DEFAULT	SkpCmd();	/* skip a single command */

EXTERN	char	*CBfPtr;	/* pointer into command string */
EXTERN	char	*CStEnd;	/* pointer to last char of command string */
EXTERN	BOOLEAN	TraceM;		/* trace mode flag */


DEFAULT FlowEC()		/* flow to end of conditional */
{
	LOCAL WORD TmpNst;

	TmpNst = 1;
	do {
		if (CBfPtr == CStEnd)
			{
			ErrMsg(ERR_UTC);
			return(FAILURE);
			}
		++CBfPtr;
		if (*CBfPtr == '"')
			++TmpNst;
		else if (*CBfPtr == '\'')
			--TmpNst;
		if (SkpCmd() == FAILURE)
			return(FAILURE);
	} while (TmpNst > 0);

	if (TraceM)
		EchoIt(*CBfPtr);

	return(SUCCESS);
}
