diff options
author | Jari Aalto <jari.aalto@cante.net> | 2009-01-12 13:36:28 +0000 |
---|---|---|
committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:47:00 +0000 |
commit | 3185942a5234e26ab13fa02f9c51d340cec514f8 (patch) | |
tree | 2c6fcd01779faef1f91c5d84d63981ca3479137d /command.h | |
parent | f1be666c7d78939ad775078d290bec2758fa29a2 (diff) | |
download | android_external_bash-3185942a5234e26ab13fa02f9c51d340cec514f8.tar.gz android_external_bash-3185942a5234e26ab13fa02f9c51d340cec514f8.tar.bz2 android_external_bash-3185942a5234e26ab13fa02f9c51d340cec514f8.zip |
Imported from ../bash-4.0-rc1.tar.gz.
Diffstat (limited to 'command.h')
-rw-r--r-- | command.h | 60 |
1 files changed, 45 insertions, 15 deletions
@@ -1,23 +1,23 @@ /* command.h -- The structures used internally to represent commands, and the extern declarations of the functions used to create them. */ -/* Copyright (C) 1993-2005 Free Software Foundation, Inc. +/* Copyright (C) 1993-2009 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. - Bash is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2, or (at your option) any later - version. + Bash is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - Bash is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. + Bash is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Bash; see the file COPYING. If not, write to the Free Software - Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ + You should have received a copy of the GNU General Public License + along with Bash. If not, see <http://www.gnu.org/licenses/>. +*/ #if !defined (_COMMAND_H_) #define _COMMAND_H_ @@ -31,7 +31,8 @@ enum r_instruction { r_duplicating_input, r_duplicating_output, r_deblank_reading_until, r_close_this, r_err_and_out, r_input_output, r_output_force, r_duplicating_input_word, r_duplicating_output_word, - r_move_input, r_move_output, r_move_input_word, r_move_output_word + r_move_input, r_move_output, r_move_input_word, r_move_output_word, + r_append_err_and_out }; /* Redirection errors. */ @@ -44,7 +45,7 @@ enum r_instruction { (ri == r_output_direction || ri == r_err_and_out) #define OUTPUT_REDIRECT(ri) \ - (ri == r_output_direction || ri == r_input_output || ri == r_err_and_out) + (ri == r_output_direction || ri == r_input_output || ri == r_err_and_out || ri == r_append_err_and_out) #define INPUT_REDIRECT(ri) \ (ri == r_input_direction || ri == r_inputa_direction || ri == r_input_output) @@ -54,6 +55,7 @@ enum r_instruction { ri == r_input_output || \ ri == r_err_and_out || \ ri == r_appending_to || \ + ri == r_append_err_and_out || \ ri == r_output_force) /* redirection needs translation */ @@ -64,7 +66,7 @@ enum r_instruction { /* Command Types: */ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select, cm_connection, cm_function_def, cm_until, cm_group, - cm_arith, cm_cond, cm_arith_for, cm_subshell }; + cm_arith, cm_cond, cm_arith_for, cm_subshell, cm_coproc }; /* Possible values for the `flags' field of a WORD_DESC. */ #define W_HASDOLLAR 0x000001 /* Dollar sign present. */ @@ -88,6 +90,8 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select, #define W_HASQUOTEDNULL 0x040000 /* word contains a quoted null character */ #define W_DQUOTE 0x080000 /* word should be treated as if double-quoted */ #define W_NOPROCSUB 0x100000 /* don't perform process substitution */ +#define W_HASCTLESC 0x200000 /* word contains literal CTLESC characters */ +#define W_ASSIGNASSOC 0x400000 /* word looks like associative array assignment */ /* Possible values for subshell_environment */ #define SUBSHELL_ASYNC 0x01 /* subshell caused by `command &' */ @@ -95,6 +99,8 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select, #define SUBSHELL_COMSUB 0x04 /* subshell caused by `command` or $(command) */ #define SUBSHELL_FORK 0x08 /* subshell caused by executing a disk command */ #define SUBSHELL_PIPE 0x10 /* subshell from a pipeline element */ +#define SUBSHELL_PROCSUB 0x20 /* subshell caused by <(command) or >(command) */ +#define SUBSHELL_COPROC 0x40 /* subshell from a coproc pipeline */ /* A structure which represents a word. */ typedef struct word_desc { @@ -156,6 +162,7 @@ typedef struct element { #define CMD_AMPERSAND 0x200 /* command & */ #define CMD_STDIN_REDIR 0x400 /* async command needs implicit </dev/null */ #define CMD_COMMAND_BUILTIN 0x0800 /* command executed by `command' builtin */ +#define CMD_COPROC_SUBSHELL 0x1000 /* What a command looks like. */ typedef struct command { @@ -185,6 +192,7 @@ typedef struct command { struct arith_for_com *ArithFor; #endif struct subshell_com *Subshell; + struct coproc_com *Coproc; } value; } COMMAND; @@ -198,6 +206,10 @@ typedef struct connection { /* Structures used to represent the CASE command. */ +/* Values for FLAGS word in a PATTERN_LIST */ +#define CASEPAT_FALLTHROUGH 0x01 +#define CASEPAT_TESTNEXT 0x02 + /* Pattern/action structure for CASE_COM. */ typedef struct pattern_list { struct pattern_list *next; /* Clause to try in case this one failed. */ @@ -322,7 +334,25 @@ typedef struct subshell_com { COMMAND *command; } SUBSHELL_COM; +typedef struct coproc { + char *c_name; + pid_t c_pid; + int c_rfd; + int c_wfd; + int c_rsave; + int c_wsave; + int c_flags; + int c_status; +} Coproc; + +typedef struct coproc_com { + int flags; + char *name; + COMMAND *command; +} COPROC_COM; + extern COMMAND *global_command; +extern Coproc sh_coproc; /* Possible command errors */ #define CMDERR_DEFAULT 0 |