eval.h revision 50471
10SN/A/*-
216651Smullan * Copyright (c) 1991, 1993
30SN/A *	The Regents of the University of California.  All rights reserved.
40SN/A *
50SN/A * This code is derived from software contributed to Berkeley by
60SN/A * Kenneth Almquist.
72362SN/A *
80SN/A * Redistribution and use in source and binary forms, with or without
92362SN/A * modification, are permitted provided that the following conditions
100SN/A * are met:
110SN/A * 1. Redistributions of source code must retain the above copyright
120SN/A *    notice, this list of conditions and the following disclaimer.
130SN/A * 2. Redistributions in binary form must reproduce the above copyright
140SN/A *    notice, this list of conditions and the following disclaimer in the
150SN/A *    documentation and/or other materials provided with the distribution.
160SN/A * 3. All advertising materials mentioning features or use of this software
170SN/A *    must display the following acknowledgement:
180SN/A *	This product includes software developed by the University of
190SN/A *	California, Berkeley and its contributors.
200SN/A * 4. Neither the name of the University nor the names of its contributors
212362SN/A *    may be used to endorse or promote products derived from this software
222362SN/A *    without specific prior written permission.
232362SN/A *
240SN/A * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
250SN/A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
260SN/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
270SN/A * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
280SN/A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
290SN/A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
300SN/A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
310SN/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
320SN/A * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
330SN/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3417338Smli * SUCH DAMAGE.
3511581Sjuh *
3611581Sjuh *	@(#)eval.h	8.2 (Berkeley) 5/4/95
3711581Sjuh * $FreeBSD: head/bin/sh/eval.h 50471 1999-08-27 23:15:48Z peter $
380SN/A */
3916651Smullan
400SN/Aextern char *commandname;	/* currently executing command */
410SN/Aextern int exitstatus;		/* exit status of last command */
420SN/Aextern struct strlist *cmdenviron;  /* environment for builtin command */
430SN/A
440SN/A
450SN/Astruct backcmd {		/* result of evalbackcmd */
460SN/A	int fd;			/* file descriptor to read from */
470SN/A	char *buf;		/* buffer */
480SN/A	int nleft;		/* number of chars in buffer */
490SN/A	struct job *jp;		/* job structure for command */
50};
51
52int evalcmd __P((int, char **));
53void evalstring __P((char *));
54union node;	/* BLETCH for ansi C */
55void evaltree __P((union node *, int));
56void evalbackcmd __P((union node *, struct backcmd *));
57int bltincmd __P((int, char **));
58int breakcmd __P((int, char **));
59int returncmd __P((int, char **));
60int falsecmd __P((int, char **));
61int truecmd __P((int, char **));
62int execcmd __P((int, char **));
63
64/* in_function returns nonzero if we are currently evaluating a function */
65#define in_function()	funcnest
66extern int funcnest;
67extern int evalskip;
68
69/* reasons for skipping commands (see comment on breakcmd routine) */
70#define SKIPBREAK	1
71#define SKIPCONT	2
72#define SKIPFUNC	3
73#define SKIPFILE	4
74