]> git.ipfire.org Git - thirdparty/bash.git/blame - shell.h
Imported from ../bash-1.14.7.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
19 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20
21#include "config.h"
22#include "command.h"
23#include "general.h"
24#include "error.h"
25#include "variables.h"
26#include "quit.h"
27#include "maxpath.h"
28#include "unwind_prot.h"
29#include "dispose_cmd.h"
30#include "make_cmd.h"
31#include "subst.h"
32#include "externs.h"
33
34extern int EOF_Reached;
35
36#define NO_PIPE -1
37#define REDIRECT_BOTH -2
38#define IS_DESCRIPTOR -1
39
40#define NO_VARIABLE -1
41
42/* A bunch of stuff for flow of control using setjmp () and longjmp (). */
43#include <setjmp.h>
44extern jmp_buf top_level, catch;
45
46#define NOT_JUMPED 0 /* Not returning from a longjmp. */
47#define FORCE_EOF 1 /* We want to stop parsing. */
48#define DISCARD 2 /* Discard current command. */
49#define EXITPROG 3 /* Unconditionally exit the program now. */
50
51/* Values that can be returned by execute_command (). */
52#define EXECUTION_FAILURE 1
53#define EXECUTION_SUCCESS 0
54
55/* Usage messages by builtins result in a return status of 2. */
56#define EX_USAGE 2
57
58/* Special exit status used when the shell is asked to execute a
59 binary file as a shell script. */
60#define EX_BINARY_FILE 126
61#define EX_NOEXEC 126
62#define EX_NOTFOUND 127
63
64/* The list of characters that are quoted in double-quotes with a
65 backslash. Other characters following a backslash cause nothing
66 special to happen. */
67#define slashify_in_quotes "\\`$\""
68#define slashify_in_here_document "\\`$"
69
70/* Constants which specify how to handle backslashes and quoting in
71 expand_word_internal (). Q_DOUBLE_QUOTES means to use the function
72 slashify_in_quotes () to decide whether the backslash should be
73 retained. Q_HERE_DOCUMENT means slashify_in_here_document () to
74 decide whether to retain the backslash. Q_KEEP_BACKSLASH means
75 to unconditionally retain the backslash. */
76#define Q_DOUBLE_QUOTES 0x1
77#define Q_HERE_DOCUMENT 0x2
78#define Q_KEEP_BACKSLASH 0x4
79
80extern char **shell_environment;
81extern WORD_LIST *rest_of_args;
82
83/* Generalized global variables. */
84extern 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. */
88struct 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. */
99struct user_info {
100 int uid, euid;
101 int gid, egid;
102 char *user_name;
103 char *shell; /* shell from the password file */
104 char *home_dir;
105};
106
107extern struct user_info current_user;