/*
 * This file was generated by the mkinit program.
 */

#include "shell.h"
#include "mystring.h"
#include "init.h"
#include "eval.h"
#include "input.h"
#include "error.h"
#include "redir.h"



#undef  ATABSIZE
#define ATABSIZE 39
#undef  CMDTABLESIZE
#define CMDTABLESIZE 31		/* should be prime */
#undef  EOF_NLEFT
#define EOF_NLEFT -99		/* value of parsenleft when EOF pushed back */
#undef  DOWAIT_BLOCK
#define DOWAIT_BLOCK	0x1 /* wait until a child exits */
#undef  DOWAIT_SIG
#define DOWAIT_SIG	0x2 /* if DOWAIT_BLOCK, abort on signals */
#undef  MAXCMDTEXT
#define MAXCMDTEXT	200
#undef  DEFINE_OPTIONS
#define DEFINE_OPTIONS
#undef 	EOFMARKLEN
#define	EOFMARKLEN	79
#undef 	PROMPTLEN
#define	PROMPTLEN	128
#undef  CHKALIAS
#define CHKALIAS	0x1
#undef  CHKKWD
#define CHKKWD		0x2
#undef  CHKNL
#define CHKNL		0x4
#undef  MAXNEST_static
#define MAXNEST_static 8
#undef  EMPTY
#define EMPTY -2		/* marks an unused slot in redirtab */
#undef  CLOSED
#define CLOSED -1		/* fd was not open before redir */
#undef  PIPESIZE
#define PIPESIZE 4096		/* amount of buffering in a pipe */
#undef  S_DFL
#define S_DFL 1			/* default signal handling (SIG_DFL) */
#undef  S_CATCH
#define S_CATCH 2		/* signal is caught */
#undef  S_IGN
#define S_IGN 3			/* signal is ignored (SIG_IGN) */
#undef  S_HARD_IGN
#define S_HARD_IGN 4		/* signal is ignored permanently */
#undef  S_RESET
#define S_RESET 5		/* temporary - to reset a hard ignored sig */
#undef  VTABSIZE
#define VTABSIZE 39



extern int loopnest;		/* current loop nesting level */

extern int parselleft;		/* copy of parsefile->lleft */

extern pid_t backgndpid;	/* pid of last background process */
extern struct job *bgjob; /* last background process */
extern int jobctl;

extern int tokpushback;		/* last token pushed back */
extern int checkkwd;            /* 1 == check for kwds, 2 == also eat newlines */

struct redirtab {
	struct redirtab *next;
	int renamed[10];
};

extern struct redirtab *redirlist;

extern char sigmode[NSIG];	/* current value of signal */



/*
 * This routine is called when an error or an interrupt occurs in an
 * interactive shell and control is returned to the main command loop.
 */

void
reset(void)
{

      /* from eval.c: */
      {
	      evalskip = 0;
	      loopnest = 0;
	      funcnest = 0;
      }

      /* from input.c: */
      {
	      popallfiles();
	      parselleft = parsenleft = 0;	/* clear input buffer */
      }

      /* from parser.c: */
      {
	      tokpushback = 0;
	      checkkwd = 0;
      }

      /* from redir.c: */
      {
	      while (redirlist)
		      popredir();
      }
}
