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

	IncCBp()

	This function increments the command buffer pointer CBfPtr.  It
checks whether incrementing the command buffer pointer will move the command
buffer pointer past the end of the command buffer.

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

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

extern	VOID	EchoIt();	/* echo 1 character to the terminal */
extern	VOID	ErrMsg();	/* type error message */

EXTERN	char	*CBfPtr;	/* pointer into command string */
EXTERN	char	*CStEnd;	/* pointer to last char of command string */
EXTERN	WORD	MStTop;		/* macro stack top */
EXTERN	BOOLEAN	TraceM;		/* trace mode flag */


DEFAULT IncCBP()
{
	if (CBfPtr == CStEnd)			/* if end of command string */
		if (MStTop < 0)			/* if not in a macro */
			{
			ErrMsg(ERR_UTC);	/* unterminated command */
			return(FAILURE);
			}
		else
			return(SUCCESS);
	++CBfPtr;
	if (TraceM)				/* if trace mode is on */
		EchoIt(*CBfPtr);		/* display the character */
	return(SUCCESS);
}
