]> git.ipfire.org Git - thirdparty/bash.git/blame - shell.h
Imported from ../bash-2.05b.tar.gz.
[thirdparty/bash.git] / shell.h
CommitLineData
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 20
f73dda09 21#ifdef HAVE_CONFIG_H
726f6388 22#include "config.h"
f73dda09 23#endif
ccc6cda3
JA
24
25#include "bashjmp.h"
26
726f6388 27#include "command.h"
28ef6c31 28#include "syntax.h"
726f6388
JA
29#include "general.h"
30#include "error.h"
31#include "variables.h"
f73dda09 32#include "arrayfunc.h"
726f6388
JA
33#include "quit.h"
34#include "maxpath.h"
35#include "unwind_prot.h"
36#include "dispose_cmd.h"
37#include "make_cmd.h"
7117c2d2 38#include "ocache.h"
726f6388 39#include "subst.h"
ccc6cda3
JA
40#include "sig.h"
41#include "pathnames.h"
726f6388 42#include "externs.h"
f73dda09 43#include "version.h"
726f6388
JA
44
45extern int EOF_Reached;
46
47#define NO_PIPE -1
48#define REDIRECT_BOTH -2
726f6388
JA
49
50#define NO_VARIABLE -1
51
726f6388
JA
52/* Values that can be returned by execute_command (). */
53#define EXECUTION_FAILURE 1
54#define EXECUTION_SUCCESS 0
55
56/* Usage messages by builtins result in a return status of 2. */
ccc6cda3
JA
57#define EX_BADUSAGE 2
58
59/* Special exit statuses used by the shell, internally and externally. */
60#define EX_BINARY_FILE 126
61#define EX_NOEXEC 126
62#define EX_NOINPUT 126
63#define EX_NOTFOUND 127
726f6388 64
ccc6cda3
JA
65#define EX_SHERRBASE 256 /* all special error values are > this. */
66
67#define EX_BADSYNTAX 257 /* shell syntax error */
68#define EX_USAGE 258 /* syntax error in usage */
69#define EX_REDIRFAIL 259 /* redirection failed */
70#define EX_BADASSIGN 260 /* variable assignment error */
71#define EX_EXPFAIL 261 /* word expansion failed */
726f6388 72
ccc6cda3
JA
73/* Flag values that control parameter pattern substitution. */
74#define MATCH_ANY 0x0
75#define MATCH_BEG 0x1
76#define MATCH_END 0x2
77
78#define MATCH_TYPEMASK 0x3
79
80#define MATCH_GLOBREP 0x10
81#define MATCH_QUOTED 0x20
726f6388 82
ccc6cda3 83/* Some needed external declarations. */
726f6388
JA
84extern char **shell_environment;
85extern WORD_LIST *rest_of_args;
86
87/* Generalized global variables. */
88extern int executing, login_shell;
f73dda09 89extern int interactive, interactive_shell;
7117c2d2 90extern int startup_state;
726f6388
JA
91
92/* Structure to pass around that holds a bitmap of file descriptors
93 to close, and the size of that structure. Used in execute_cmd.c. */
94struct fd_bitmap {
f73dda09 95 int size;
726f6388
JA
96 char *bitmap;
97};
98
99#define FD_BITMAP_SIZE 32
100
101#define CTLESC '\001'
102#define CTLNUL '\177'
103
104/* Information about the current user. */
105struct user_info {
d166f048
JA
106 uid_t uid, euid;
107 gid_t gid, egid;
726f6388
JA
108 char *user_name;
109 char *shell; /* shell from the password file */
110 char *home_dir;
111};
112
113extern struct user_info current_user;
f73dda09
JA
114
115/* Force gcc to not clobber X on a longjmp(). Old versions of gcc mangle
116 this badly. */
7117c2d2 117#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ > 8)
f73dda09
JA
118# define USE_VAR(x) ((void) &(x))
119#else
120# define USE_VAR(x)
121#endif