]>
Commit | Line | Data |
---|---|---|
726f6388 JA |
1 | /* shell.h -- The data structures used by the shell */ |
2 | ||
3 | /* Copyright (C) 1993 Free Software Foundation, Inc. | |
4 | ||
5 | This file is part of GNU Bash, the Bourne Again SHell. | |
6 | ||
7 | Bash is free software; you can redistribute it and/or modify it under | |
8 | the terms of the GNU General Public License as published by the Free | |
9 | Software Foundation; either version 2, or (at your option) any later | |
10 | version. | |
11 | ||
12 | Bash is distributed in the hope that it will be useful, but WITHOUT ANY | |
13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License along | |
18 | with Bash; see the file COPYING. If not, write to the Free Software | |
bb70624e | 19 | Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ |
726f6388 JA |
20 | |
21 | #include "config.h" | |
ccc6cda3 JA |
22 | |
23 | #include "bashjmp.h" | |
24 | ||
726f6388 | 25 | #include "command.h" |
28ef6c31 | 26 | #include "syntax.h" |
726f6388 JA |
27 | #include "general.h" |
28 | #include "error.h" | |
29 | #include "variables.h" | |
30 | #include "quit.h" | |
31 | #include "maxpath.h" | |
32 | #include "unwind_prot.h" | |
33 | #include "dispose_cmd.h" | |
34 | #include "make_cmd.h" | |
35 | #include "subst.h" | |
ccc6cda3 JA |
36 | #include "sig.h" |
37 | #include "pathnames.h" | |
726f6388 JA |
38 | #include "externs.h" |
39 | ||
40 | extern int EOF_Reached; | |
41 | ||
42 | #define NO_PIPE -1 | |
43 | #define REDIRECT_BOTH -2 | |
44 | #define IS_DESCRIPTOR -1 | |
45 | ||
46 | #define NO_VARIABLE -1 | |
47 | ||
726f6388 JA |
48 | /* Values that can be returned by execute_command (). */ |
49 | #define EXECUTION_FAILURE 1 | |
50 | #define EXECUTION_SUCCESS 0 | |
51 | ||
52 | /* Usage messages by builtins result in a return status of 2. */ | |
ccc6cda3 JA |
53 | #define EX_BADUSAGE 2 |
54 | ||
55 | /* Special exit statuses used by the shell, internally and externally. */ | |
56 | #define EX_BINARY_FILE 126 | |
57 | #define EX_NOEXEC 126 | |
58 | #define EX_NOINPUT 126 | |
59 | #define EX_NOTFOUND 127 | |
726f6388 | 60 | |
ccc6cda3 JA |
61 | #define EX_SHERRBASE 256 /* all special error values are > this. */ |
62 | ||
63 | #define EX_BADSYNTAX 257 /* shell syntax error */ | |
64 | #define EX_USAGE 258 /* syntax error in usage */ | |
65 | #define EX_REDIRFAIL 259 /* redirection failed */ | |
66 | #define EX_BADASSIGN 260 /* variable assignment error */ | |
67 | #define EX_EXPFAIL 261 /* word expansion failed */ | |
726f6388 | 68 | |
ccc6cda3 JA |
69 | /* Flag values that control parameter pattern substitution. */ |
70 | #define MATCH_ANY 0x0 | |
71 | #define MATCH_BEG 0x1 | |
72 | #define MATCH_END 0x2 | |
73 | ||
74 | #define MATCH_TYPEMASK 0x3 | |
75 | ||
76 | #define MATCH_GLOBREP 0x10 | |
77 | #define MATCH_QUOTED 0x20 | |
726f6388 | 78 | |
ccc6cda3 | 79 | /* Some needed external declarations. */ |
726f6388 JA |
80 | extern char **shell_environment; |
81 | extern WORD_LIST *rest_of_args; | |
82 | ||
83 | /* Generalized global variables. */ | |
84 | extern int executing, login_shell; | |
85 | ||
86 | /* Structure to pass around that holds a bitmap of file descriptors | |
87 | to close, and the size of that structure. Used in execute_cmd.c. */ | |
88 | struct fd_bitmap { | |
89 | long size; | |
90 | char *bitmap; | |
91 | }; | |
92 | ||
93 | #define FD_BITMAP_SIZE 32 | |
94 | ||
95 | #define CTLESC '\001' | |
96 | #define CTLNUL '\177' | |
97 | ||
98 | /* Information about the current user. */ | |
99 | struct user_info { | |
d166f048 JA |
100 | uid_t uid, euid; |
101 | gid_t gid, egid; | |
726f6388 JA |
102 | char *user_name; |
103 | char *shell; /* shell from the password file */ | |
104 | char *home_dir; | |
105 | }; | |
106 | ||
107 | extern struct user_info current_user; |