]>
git.ipfire.org Git - thirdparty/bash.git/blob - shell.h
1 /* shell.h -- The data structures used by the shell */
3 /* Copyright (C) 1993 Free Software Foundation, Inc.
5 This file is part of GNU Bash, the Bourne Again SHell.
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
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
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
19 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
28 #include "variables.h"
31 #include "unwind_prot.h"
32 #include "dispose_cmd.h"
36 #include "pathnames.h"
39 extern int EOF_Reached
;
42 #define REDIRECT_BOTH -2
43 #define IS_DESCRIPTOR -1
45 #define NO_VARIABLE -1
47 /* Values that can be returned by execute_command (). */
48 #define EXECUTION_FAILURE 1
49 #define EXECUTION_SUCCESS 0
51 /* Usage messages by builtins result in a return status of 2. */
54 /* Special exit statuses used by the shell, internally and externally. */
55 #define EX_BINARY_FILE 126
57 #define EX_NOINPUT 126
58 #define EX_NOTFOUND 127
60 #define EX_SHERRBASE 256 /* all special error values are > this. */
62 #define EX_BADSYNTAX 257 /* shell syntax error */
63 #define EX_USAGE 258 /* syntax error in usage */
64 #define EX_REDIRFAIL 259 /* redirection failed */
65 #define EX_BADASSIGN 260 /* variable assignment error */
66 #define EX_EXPFAIL 261 /* word expansion failed */
68 /* The list of characters that are quoted in double-quotes with a
69 backslash. Other characters following a backslash cause nothing
71 #define slashify_in_quotes "\\`$\"\n"
72 #define slashify_in_here_document "\\`$"
74 /* Constants which specify how to handle backslashes and quoting in
75 expand_word_internal (). Q_DOUBLE_QUOTES means to use the function
76 slashify_in_quotes () to decide whether the backslash should be
77 retained. Q_HERE_DOCUMENT means slashify_in_here_document () to
78 decide whether to retain the backslash. Q_KEEP_BACKSLASH means
79 to unconditionally retain the backslash. */
80 #define Q_DOUBLE_QUOTES 0x1
81 #define Q_HERE_DOCUMENT 0x2
82 #define Q_KEEP_BACKSLASH 0x4
85 #define Q_ADDEDQUOTES 0x20
86 #define Q_QUOTEDNULL 0x40
88 /* Flag values that control parameter pattern substitution. */
93 #define MATCH_TYPEMASK 0x3
95 #define MATCH_GLOBREP 0x10
96 #define MATCH_QUOTED 0x20
98 /* Some needed external declarations. */
99 extern char **shell_environment
;
100 extern WORD_LIST
*rest_of_args
;
102 /* Generalized global variables. */
103 extern int executing
, login_shell
;
105 /* Structure to pass around that holds a bitmap of file descriptors
106 to close, and the size of that structure. Used in execute_cmd.c. */
112 #define FD_BITMAP_SIZE 32
114 #define CTLESC '\001'
115 #define CTLNUL '\177'
117 /* Information about the current user. */
122 char *shell
; /* shell from the password file */
126 extern struct user_info current_user
;