1dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project/*	$NetBSD: exec.h,v 1.21 2003/08/07 09:05:31 agc Exp $	*/
2dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project
3dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project/*-
4dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * Copyright (c) 1991, 1993
5dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project *	The Regents of the University of California.  All rights reserved.
6dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project *
7dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * This code is derived from software contributed to Berkeley by
8dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * Kenneth Almquist.
9dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project *
10dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * Redistribution and use in source and binary forms, with or without
11dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * modification, are permitted provided that the following conditions
12dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * are met:
13dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * 1. Redistributions of source code must retain the above copyright
14dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project *    notice, this list of conditions and the following disclaimer.
15dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * 2. Redistributions in binary form must reproduce the above copyright
16dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project *    notice, this list of conditions and the following disclaimer in the
17dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project *    documentation and/or other materials provided with the distribution.
18dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * 3. Neither the name of the University nor the names of its contributors
19dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project *    may be used to endorse or promote products derived from this software
20dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project *    without specific prior written permission.
21dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project *
22dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project * SUCH DAMAGE.
33dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project *
34dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project *	@(#)exec.h	8.3 (Berkeley) 6/8/95
35dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project */
36dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project
37dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project/* values of cmdtype */
38dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project#define CMDUNKNOWN	-1	/* no entry in table for command */
39dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project#define CMDNORMAL	0	/* command is an executable program */
40dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project#define CMDFUNCTION	1	/* command is a shell function */
41dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project#define CMDBUILTIN	2	/* command is a shell builtin */
42dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project#define CMDSPLBLTIN	3	/* command is a special shell builtin */
43dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project
44dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project
45dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectstruct cmdentry {
46dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project	int cmdtype;
47dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project	union param {
48dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project		int index;
49dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project		int (*bltin)(int, char**);
50dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project		union node *func;
51dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project	} u;
52dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project};
53dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project
54dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project
55dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project/* action to find_command() */
56dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project#define DO_ERR		0x01	/* prints errors */
57dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project#define DO_ABS		0x02	/* checks absolute paths */
58dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project#define DO_NOFUNC	0x04	/* don't return shell functions, for command */
59dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project#define DO_ALTPATH	0x08	/* using alternate path */
60dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project#define DO_ALTBLTIN	0x20	/* %builtin in alt. path */
61dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project
62dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectextern const char *pathopt;	/* set by padvance */
63dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project
64dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectvoid shellexec(char **, char **, const char *, int, int)
65dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Project    __attribute__((__noreturn__));
66dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectchar *padvance(const char **, const char *);
67dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectint hashcmd(int, char **);
68dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectvoid find_command(char *, struct cmdentry *, int, const char *);
69dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectint (*find_builtin(char *))(int, char **);
70dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectint (*find_splbltin(char *))(int, char **);
71dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectvoid hashcd(void);
72dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectvoid changepath(const char *);
73dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectvoid deletefuncs(void);
74dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectvoid getcmdentry(char *, struct cmdentry *);
75dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectvoid addcmdentry(char *, struct cmdentry *);
76dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectvoid defun(char *, union node *);
77dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectint unsetfunc(char *);
78dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectint typecmd(int, char **);
79dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0The Android Open Source Projectvoid hash_special_builtins(void);