source:
patches/bash-4.3-branch_update-5.patch@
82f26bf
Last change on this file since 82f26bf was 75a0579, checked in by , 10 years ago | |
---|---|
|
|
File size: 126.1 KB |
-
arrayfunc.c
Submitted By: William Harrington (kb0iic at cross-lfs dot org) Date: 10-10-2014 Initial Package Version: 4.3 Origin: Upstream Upstream Status: Applied Description: Contains all upstream patches up to 4.3-030 diff -Naur bash-4.3.orig/arrayfunc.c bash-4.3/arrayfunc.c
old new 179 179 array_insert (array_cell (entry), ind, newval); 180 180 FREE (newval); 181 181 182 VUNSETATTR (entry, att_invisible); /* no longer invisible */ 182 183 return (entry); 183 184 } 184 185 … … 597 598 if (assoc_p (var)) 598 599 { 599 600 val = expand_assignment_string_to_string (val, 0); 601 if (val == 0) 602 { 603 val = (char *)xmalloc (1); 604 val[0] = '\0'; /* like do_assignment_internal */ 605 } 600 606 free_val = 1; 601 607 } 602 608 -
bashline.c
diff -Naur bash-4.3.orig/bashline.c bash-4.3/bashline.c
old new 4167 4167 int qc; 4168 4168 4169 4169 qc = rl_dispatching ? rl_completion_quote_character : 0; 4170 dfn = bash_dequote_filename ((char *)text, qc); 4170 /* If rl_completion_found_quote != 0, rl_completion_matches will call the 4171 filename dequoting function, causing the directory name to be dequoted 4172 twice. */ 4173 if (rl_dispatching && rl_completion_found_quote == 0) 4174 dfn = bash_dequote_filename ((char *)text, qc); 4175 else 4176 dfn = (char *)text; 4171 4177 m1 = rl_completion_matches (dfn, rl_filename_completion_function); 4172 free (dfn); 4178 if (dfn != text) 4179 free (dfn); 4173 4180 4174 4181 if (m1 == 0 || m1[0] == 0) 4175 4182 return m1; -
builtins/common.h
diff -Naur bash-4.3.orig/builtins/common.h bash-4.3/builtins/common.h
old new 33 33 #define SEVAL_RESETLINE 0x010 34 34 #define SEVAL_PARSEONLY 0x020 35 35 #define SEVAL_NOLONGJMP 0x040 36 #define SEVAL_FUNCDEF 0x080 /* only allow function definitions */ 37 #define SEVAL_ONECMD 0x100 /* only allow a single command */ 36 38 37 39 /* Flags for describe_command, shared between type.def and command.def */ 38 40 #define CDESC_ALL 0x001 /* type -a */ -
builtins/evalstring.c
diff -Naur bash-4.3.orig/builtins/evalstring.c bash-4.3/builtins/evalstring.c
old new 308 308 { 309 309 struct fd_bitmap *bitmap; 310 310 311 if (flags & SEVAL_FUNCDEF) 312 { 313 char *x; 314 315 /* If the command parses to something other than a straight 316 function definition, or if we have not consumed the entire 317 string, or if the parser has transformed the function 318 name (as parsing will if it begins or ends with shell 319 whitespace, for example), reject the attempt */ 320 if (command->type != cm_function_def || 321 ((x = parser_remaining_input ()) && *x) || 322 (STREQ (from_file, command->value.Function_def->name->word) == 0)) 323 { 324 internal_warning (_("%s: ignoring function definition attempt"), from_file); 325 should_jump_to_top_level = 0; 326 last_result = last_command_exit_value = EX_BADUSAGE; 327 reset_parser (); 328 break; 329 } 330 } 331 311 332 bitmap = new_fd_bitmap (FD_BITMAP_SIZE); 312 333 begin_unwind_frame ("pe_dispose"); 313 334 add_unwind_protect (dispose_fd_bitmap, bitmap); … … 368 389 dispose_command (command); 369 390 dispose_fd_bitmap (bitmap); 370 391 discard_unwind_frame ("pe_dispose"); 392 393 if (flags & SEVAL_ONECMD) 394 { 395 reset_parser (); 396 break; 397 } 371 398 } 372 399 } 373 400 else -
builtins/read.def
diff -Naur bash-4.3.orig/builtins/read.def bash-4.3/builtins/read.def
old new 442 442 add_unwind_protect (reset_alarm, (char *)NULL); 443 443 #if defined (READLINE) 444 444 if (edit) 445 add_unwind_protect (reset_attempted_completion_function, (char *)NULL); 445 { 446 add_unwind_protect (reset_attempted_completion_function, (char *)NULL); 447 add_unwind_protect (bashline_reset_event_hook, (char *)NULL); 448 } 446 449 #endif 447 450 falarm (tmsec, tmusec); 448 451 } … … 1021 1024 1022 1025 old_attempted_completion_function = rl_attempted_completion_function; 1023 1026 rl_attempted_completion_function = (rl_completion_func_t *)NULL; 1027 bashline_set_event_hook (); 1024 1028 if (itext) 1025 1029 { 1026 1030 old_startup_hook = rl_startup_hook; … … 1032 1036 1033 1037 rl_attempted_completion_function = old_attempted_completion_function; 1034 1038 old_attempted_completion_function = (rl_completion_func_t *)NULL; 1039 bashline_reset_event_hook (); 1035 1040 1036 1041 if (ret == 0) 1037 1042 return ret; -
copy_cmd.c
diff -Naur bash-4.3.orig/copy_cmd.c bash-4.3/copy_cmd.c
old new 126 126 { 127 127 case r_reading_until: 128 128 case r_deblank_reading_until: 129 new_redirect->here_doc_eof = savestring (redirect->here_doc_eof);129 new_redirect->here_doc_eof = redirect->here_doc_eof ? savestring (redirect->here_doc_eof) : 0; 130 130 /*FALLTHROUGH*/ 131 131 case r_reading_string: 132 132 case r_appending_to: -
execute_cmd.c
diff -Naur bash-4.3.orig/execute_cmd.c bash-4.3/execute_cmd.c
old new 2409 2409 #endif 2410 2410 lstdin = wait_for (lastpid); 2411 2411 #if defined (JOB_CONTROL) 2412 exec_result = job_exit_status (lastpipe_jid); 2412 /* If wait_for removes the job from the jobs table, use result of last 2413 command as pipeline's exit status as usual. The jobs list can get 2414 frozen and unfrozen at inconvenient times if there are multiple pipelines 2415 running simultaneously. */ 2416 if (INVALID_JOB (lastpipe_jid) == 0) 2417 exec_result = job_exit_status (lastpipe_jid); 2418 else if (pipefail_opt) 2419 exec_result = exec_result | lstdin; /* XXX */ 2420 /* otherwise we use exec_result */ 2421 2413 2422 #endif 2414 2423 unfreeze_jobs_list (); 2415 2424 } -
externs.h
diff -Naur bash-4.3.orig/externs.h bash-4.3/externs.h
old new 324 324 extern char *sh_backslash_quote __P((char *, const char *, int)); 325 325 extern char *sh_backslash_quote_for_double_quotes __P((char *)); 326 326 extern int sh_contains_shell_metas __P((char *)); 327 extern int sh_contains_quotes __P((char *)); 327 328 328 329 /* declarations for functions defined in lib/sh/spell.c */ 329 330 extern int spname __P((char *, char *)); -
bash-4.3
diff -Naur bash-4.3.orig/jobs.c bash-4.3/jobs.c
old new 3597 3597 unwind_protect_int (jobs_list_frozen); 3598 3598 unwind_protect_pointer (the_pipeline); 3599 3599 unwind_protect_pointer (subst_assign_varlist); 3600 unwind_protect_pointer (this_shell_builtin); 3600 3601 3601 3602 /* We have to add the commands this way because they will be run 3602 3603 in reverse order of adding. We don't want maybe_set_sigchld_trap () … … 4374 4375 void 4375 4376 end_job_control () 4376 4377 { 4377 if (interactive_shell ) /* XXX - should it be interactive? */4378 if (interactive_shell || job_control) /* XXX - should it be just job_control? */ 4378 4379 { 4379 4380 terminate_stopped_jobs (); 4380 4381 -
lib/glob/glob.c
diff -Naur bash-4.3.orig/lib/glob/glob.c bash-4.3/lib/glob/glob.c
old new 123 123 extern char *glob_patscan __P((char *, char *, int)); 124 124 extern wchar_t *glob_patscan_wc __P((wchar_t *, wchar_t *, int)); 125 125 126 extern char *glob_dirscan __P((char *, int)); 127 126 128 /* Compile `glob_loop.c' for single-byte characters. */ 127 129 #define CHAR unsigned char 128 130 #define INT int … … 179 181 char *pat, *dname; 180 182 int flags; 181 183 { 182 char *pp, *pe, *t ;183 int n, r ;184 char *pp, *pe, *t, *se; 185 int n, r, negate; 184 186 187 negate = *pat == '!'; 185 188 pp = pat + 2; 186 pe = pp + strlen (pp) - 1; /*(*/ 187 if (*pe != ')') 189 se = pp + strlen (pp) - 1; /* end of string */ 190 pe = glob_patscan (pp, se, 0); /* end of extglob pattern (( */ 191 /* we should check for invalid extglob pattern here */ 192 if (pe == 0) 188 193 return 0; 189 if ((t = strchr (pp, '|')) == 0) /* easy case first */ 194 195 /* if pe != se we have more of the pattern at the end of the extglob 196 pattern. Check the easy case first ( */ 197 if (pe == se && *pe == ')' && (t = strchr (pp, '|')) == 0) 190 198 { 191 199 *pe = '\0'; 200 #if defined (HANDLE_MULTIBYTE) 201 r = mbskipname (pp, dname, flags); 202 #else 192 203 r = skipname (pp, dname, flags); /*(*/ 204 #endif 193 205 *pe = ')'; 194 206 return r; 195 207 } 208 209 /* check every subpattern */ 196 210 while (t = glob_patscan (pp, pe, '|')) 197 211 { 198 212 n = t[-1]; 199 213 t[-1] = '\0'; 214 #if defined (HANDLE_MULTIBYTE) 215 r = mbskipname (pp, dname, flags); 216 #else 200 217 r = skipname (pp, dname, flags); 218 #endif 201 219 t[-1] = n; 202 220 if (r == 0) /* if any pattern says not skip, we don't skip */ 203 221 return r; 204 222 pp = t; 205 223 } /*(*/ 206 224 207 if (pp == pe) /* glob_patscan might find end of pattern */ 225 /* glob_patscan might find end of pattern */ 226 if (pp == se) 208 227 return r; 209 228 210 *pe = '\0'; 211 # if defined (HANDLE_MULTIBYTE) 212 r = mbskipname (pp, dname, flags); /*(*/ 213 # else 214 r = skipname (pp, dname, flags); /*(*/ 215 # endif 216 *pe = ')'; 217 return r; 229 /* but if it doesn't then we didn't match a leading dot */ 230 return 0; 218 231 } 219 232 #endif 220 233 … … 277 290 int flags; 278 291 { 279 292 #if EXTENDED_GLOB 280 wchar_t *pp, *pe, *t, n ;281 int r ;293 wchar_t *pp, *pe, *t, n, *se; 294 int r, negate; 282 295 296 negate = *pat == L'!'; 283 297 pp = pat + 2; 284 pe = pp + wcslen (pp) - 1; /*(*/285 if (*pe != L')')286 return 0; 287 if ( (t = wcschr (pp, L'|')) == 0)298 se = pp + wcslen (pp) - 1; /*(*/ 299 pe = glob_patscan_wc (pp, se, 0); 300 301 if (pe == se && *pe == ')' && (t = wcschr (pp, L'|')) == 0) 288 302 { 289 303 *pe = L'\0'; 290 304 r = wchkname (pp, dname); /*(*/ 291 305 *pe = L')'; 292 306 return r; 293 307 } 308 309 /* check every subpattern */ 294 310 while (t = glob_patscan_wc (pp, pe, '|')) 295 311 { 296 312 n = t[-1]; … … 305 321 if (pp == pe) /* glob_patscan_wc might find end of pattern */ 306 322 return r; 307 323 308 *pe = L'\0'; 309 r = wchkname (pp, dname); /*(*/ 310 *pe = L')'; 311 return r; 324 /* but if it doesn't then we didn't match a leading dot */ 325 return 0; 312 326 #else 313 327 return (wchkname (pat, dname)); 314 328 #endif … … 1006 1020 { 1007 1021 char **result; 1008 1022 unsigned int result_size; 1009 char *directory_name, *filename, *dname ;1023 char *directory_name, *filename, *dname, *fn; 1010 1024 unsigned int directory_len; 1011 1025 int free_dirname; /* flag */ 1012 1026 int dflags; … … 1022 1036 1023 1037 /* Find the filename. */ 1024 1038 filename = strrchr (pathname, '/'); 1039 #if defined (EXTENDED_GLOB) 1040 if (filename && extended_glob) 1041 { 1042 fn = glob_dirscan (pathname, '/'); 1043 #if DEBUG_MATCHING 1044 if (fn != filename) 1045 fprintf (stderr, "glob_filename: glob_dirscan: fn (%s) != filename (%s)\n", fn ? fn : "(null)", filename); 1046 #endif 1047 filename = fn; 1048 } 1049 #endif 1050 1025 1051 if (filename == NULL) 1026 1052 { 1027 1053 filename = pathname; -
lib/glob/gmisc.c
diff -Naur bash-4.3.orig/lib/glob/gmisc.c bash-4.3/lib/glob/gmisc.c
old new 42 42 #define WLPAREN L'(' 43 43 #define WRPAREN L')' 44 44 45 extern char *glob_patscan __P((char *, char *, int)); 46 45 47 /* Return 1 of the first character of WSTRING could match the first 46 48 character of pattern WPAT. Wide character version. */ 47 49 int … … 210 212 case '+': 211 213 case '!': 212 214 case '@': 215 case '?': 213 216 return (pat[1] == LPAREN); 214 217 default: 215 218 return 0; … … 374 377 375 378 return matlen; 376 379 } 380 381 /* Skip characters in PAT and return the final occurrence of DIRSEP. This 382 is only called when extended_glob is set, so we have to skip over extglob 383 patterns x(...) */ 384 char * 385 glob_dirscan (pat, dirsep) 386 char *pat; 387 int dirsep; 388 { 389 char *p, *d, *pe, *se; 390 391 d = pe = se = 0; 392 for (p = pat; p && *p; p++) 393 { 394 if (extglob_pattern_p (p)) 395 { 396 if (se == 0) 397 se = p + strlen (p) - 1; 398 pe = glob_patscan (p + 2, se, 0); 399 if (pe == 0) 400 continue; 401 else if (*pe == 0) 402 break; 403 p = pe - 1; /* will do increment above */ 404 continue; 405 } 406 if (*p == dirsep) 407 d = p; 408 } 409 return d; 410 } -
lib/readline/display.c
diff -Naur bash-4.3.orig/lib/readline/display.c bash-4.3/lib/readline/display.c
old new 1637 1637 /* If we are changing the number of invisible characters in a line, and 1638 1638 the spot of first difference is before the end of the invisible chars, 1639 1639 lendiff needs to be adjusted. */ 1640 if (current_line == 0 && !_rl_horizontal_scroll_mode &&1640 if (current_line == 0 && /* !_rl_horizontal_scroll_mode && */ 1641 1641 current_invis_chars != visible_wrap_offset) 1642 1642 { 1643 1643 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) … … 1825 1825 else 1826 1826 _rl_last_c_pos += bytes_to_insert; 1827 1827 1828 /* XXX - we only want to do this if we are at the end of the line 1829 so we move there with _rl_move_cursor_relative */ 1828 1830 if (_rl_horizontal_scroll_mode && ((oe-old) > (ne-new))) 1829 goto clear_rest_of_line; 1831 { 1832 _rl_move_cursor_relative (ne-new, new); 1833 goto clear_rest_of_line; 1834 } 1830 1835 } 1831 1836 } 1832 1837 /* Otherwise, print over the existing material. */ … … 2677 2682 { 2678 2683 if (_rl_echoing_p) 2679 2684 { 2680 _rl_move_vert (_rl_vis_botlin); 2685 if (_rl_vis_botlin > 0) /* minor optimization plus bug fix */ 2686 _rl_move_vert (_rl_vis_botlin); 2681 2687 _rl_vis_botlin = 0; 2682 2688 fflush (rl_outstream); 2683 2689 rl_restart_output (1, 0); -
lib/readline/input.c
diff -Naur bash-4.3.orig/lib/readline/input.c bash-4.3/lib/readline/input.c
old new 534 534 return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF); 535 535 else if (_rl_caught_signal == SIGHUP || _rl_caught_signal == SIGTERM) 536 536 return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF); 537 /* keyboard-generated signals of interest */ 537 538 else if (_rl_caught_signal == SIGINT || _rl_caught_signal == SIGQUIT) 538 539 RL_CHECK_SIGNALS (); 540 /* non-keyboard-generated signals of interest */ 541 else if (_rl_caught_signal == SIGALRM 542 #if defined (SIGVTALRM) 543 || _rl_caught_signal == SIGVTALRM 544 #endif 545 ) 546 RL_CHECK_SIGNALS (); 539 547 540 548 if (rl_signal_event_hook) 541 549 (*rl_signal_event_hook) (); -
lib/readline/misc.c
diff -Naur bash-4.3.orig/lib/readline/misc.c bash-4.3/lib/readline/misc.c
old new 461 461 saved_undo_list = 0; 462 462 /* Set up rl_line_buffer and other variables from history entry */ 463 463 rl_replace_from_history (entry, 0); /* entry->line is now current */ 464 entry->data = 0; /* entry->data is now current undo list */ 464 465 /* Undo all changes to this history entry */ 465 466 while (rl_undo_list) 466 467 rl_do_undo (); … … 468 469 the timestamp. */ 469 470 FREE (entry->line); 470 471 entry->line = savestring (rl_line_buffer); 471 entry->data = 0;472 472 } 473 473 entry = previous_history (); 474 474 } -
lib/readline/readline.c
diff -Naur bash-4.3.orig/lib/readline/readline.c bash-4.3/lib/readline/readline.c
old new 744 744 r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ)); 745 745 746 746 RL_CHECK_SIGNALS (); 747 if (r == 0) /* success! */ 747 /* We only treat values < 0 specially to simulate recursion. */ 748 if (r >= 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0)) /* success! or failure! */ 748 749 { 749 750 _rl_keyseq_chain_dispose (); 750 751 RL_UNSETSTATE (RL_STATE_MULTIKEY); … … 964 965 #if defined (VI_MODE) 965 966 if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap && 966 967 key != ANYOTHERKEY && 967 rl_key_sequence_length == 1 && /* XXX */968 _rl_dispatching_keymap == vi_movement_keymap && 968 969 _rl_vi_textmod_command (key)) 969 970 _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign); 970 971 #endif -
lib/readline/readline.c.orig
diff -Naur bash-4.3.orig/lib/readline/readline.c.orig bash-4.3/lib/readline/readline.c.orig
old new 1 /* readline.c -- a general facility for reading lines of input 2 with emacs style editing and completion. */ 3 4 /* Copyright (C) 1987-2013 Free Software Foundation, Inc. 5 6 This file is part of the GNU Readline Library (Readline), a library 7 for reading lines of text with interactive input and history editing. 8 9 Readline is free software: you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 14 Readline is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with Readline. If not, see <http://www.gnu.org/licenses/>. 21 */ 22 23 #define READLINE_LIBRARY 24 25 #if defined (HAVE_CONFIG_H) 26 # include <config.h> 27 #endif 28 29 #include <sys/types.h> 30 #include "posixstat.h" 31 #include <fcntl.h> 32 #if defined (HAVE_SYS_FILE_H) 33 # include <sys/file.h> 34 #endif /* HAVE_SYS_FILE_H */ 35 36 #if defined (HAVE_UNISTD_H) 37 # include <unistd.h> 38 #endif /* HAVE_UNISTD_H */ 39 40 #if defined (HAVE_STDLIB_H) 41 # include <stdlib.h> 42 #else 43 # include "ansi_stdlib.h" 44 #endif /* HAVE_STDLIB_H */ 45 46 #if defined (HAVE_LOCALE_H) 47 # include <locale.h> 48 #endif 49 50 #include <stdio.h> 51 #include "posixjmp.h" 52 #include <errno.h> 53 54 #if !defined (errno) 55 extern int errno; 56 #endif /* !errno */ 57 58 /* System-specific feature definitions and include files. */ 59 #include "rldefs.h" 60 #include "rlmbutil.h" 61 62 #if defined (__EMX__) 63 # define INCL_DOSPROCESS 64 # include <os2.h> 65 #endif /* __EMX__ */ 66 67 /* Some standard library routines. */ 68 #include "readline.h" 69 #include "history.h" 70 71 #include "rlprivate.h" 72 #include "rlshell.h" 73 #include "xmalloc.h" 74 75 #ifndef RL_LIBRARY_VERSION 76 # define RL_LIBRARY_VERSION "5.1" 77 #endif 78 79 #ifndef RL_READLINE_VERSION 80 # define RL_READLINE_VERSION 0x0501 81 #endif 82 83 extern void _rl_free_history_entry PARAMS((HIST_ENTRY *)); 84 85 #if defined (COLOR_SUPPORT) 86 extern void _rl_parse_colors PARAMS((void)); /* XXX */ 87 #endif 88 89 90 /* Forward declarations used in this file. */ 91 static char *readline_internal PARAMS((void)); 92 static void readline_initialize_everything PARAMS((void)); 93 94 static void bind_arrow_keys_internal PARAMS((Keymap)); 95 static void bind_arrow_keys PARAMS((void)); 96 97 static void readline_default_bindings PARAMS((void)); 98 static void reset_default_bindings PARAMS((void)); 99 100 static int _rl_subseq_result PARAMS((int, Keymap, int, int)); 101 static int _rl_subseq_getchar PARAMS((int)); 102 103 /* **************************************************************** */ 104 /* */ 105 /* Line editing input utility */ 106 /* */ 107 /* **************************************************************** */ 108 109 const char *rl_library_version = RL_LIBRARY_VERSION; 110 111 int rl_readline_version = RL_READLINE_VERSION; 112 113 /* True if this is `real' readline as opposed to some stub substitute. */ 114 int rl_gnu_readline_p = 1; 115 116 /* A pointer to the keymap that is currently in use. 117 By default, it is the standard emacs keymap. */ 118 Keymap _rl_keymap = emacs_standard_keymap; 119 120 /* The current style of editing. */ 121 int rl_editing_mode = emacs_mode; 122 123 /* The current insert mode: input (the default) or overwrite */ 124 int rl_insert_mode = RL_IM_DEFAULT; 125 126 /* Non-zero if we called this function from _rl_dispatch(). It's present 127 so functions can find out whether they were called from a key binding 128 or directly from an application. */ 129 int rl_dispatching; 130 131 /* Non-zero if the previous command was a kill command. */ 132 int _rl_last_command_was_kill = 0; 133 134 /* The current value of the numeric argument specified by the user. */ 135 int rl_numeric_arg = 1; 136 137 /* Non-zero if an argument was typed. */ 138 int rl_explicit_arg = 0; 139 140 /* Temporary value used while generating the argument. */ 141 int rl_arg_sign = 1; 142 143 /* Non-zero means we have been called at least once before. */ 144 static int rl_initialized; 145 146 #if 0 147 /* If non-zero, this program is running in an EMACS buffer. */ 148 static int running_in_emacs; 149 #endif 150 151 /* Flags word encapsulating the current readline state. */ 152 int rl_readline_state = RL_STATE_NONE; 153 154 /* The current offset in the current input line. */ 155 int rl_point; 156 157 /* Mark in the current input line. */ 158 int rl_mark; 159 160 /* Length of the current input line. */ 161 int rl_end; 162 163 /* Make this non-zero to return the current input_line. */ 164 int rl_done; 165 166 /* The last function executed by readline. */ 167 rl_command_func_t *rl_last_func = (rl_command_func_t *)NULL; 168 169 /* Top level environment for readline_internal (). */ 170 procenv_t _rl_top_level; 171 172 /* The streams we interact with. */ 173 FILE *_rl_in_stream, *_rl_out_stream; 174 175 /* The names of the streams that we do input and output to. */ 176 FILE *rl_instream = (FILE *)NULL; 177 FILE *rl_outstream = (FILE *)NULL; 178 179 /* Non-zero means echo characters as they are read. Defaults to no echo; 180 set to 1 if there is a controlling terminal, we can get its attributes, 181 and the attributes include `echo'. Look at rltty.c:prepare_terminal_settings 182 for the code that sets it. */ 183 int _rl_echoing_p = 0; 184 185 /* Current prompt. */ 186 char *rl_prompt = (char *)NULL; 187 int rl_visible_prompt_length = 0; 188 189 /* Set to non-zero by calling application if it has already printed rl_prompt 190 and does not want readline to do it the first time. */ 191 int rl_already_prompted = 0; 192 193 /* The number of characters read in order to type this complete command. */ 194 int rl_key_sequence_length = 0; 195 196 /* If non-zero, then this is the address of a function to call just 197 before readline_internal_setup () prints the first prompt. */ 198 rl_hook_func_t *rl_startup_hook = (rl_hook_func_t *)NULL; 199 200 /* If non-zero, this is the address of a function to call just before 201 readline_internal_setup () returns and readline_internal starts 202 reading input characters. */ 203 rl_hook_func_t *rl_pre_input_hook = (rl_hook_func_t *)NULL; 204 205 /* What we use internally. You should always refer to RL_LINE_BUFFER. */ 206 static char *the_line; 207 208 /* The character that can generate an EOF. Really read from 209 the terminal driver... just defaulted here. */ 210 int _rl_eof_char = CTRL ('D'); 211 212 /* Non-zero makes this the next keystroke to read. */ 213 int rl_pending_input = 0; 214 215 /* Pointer to a useful terminal name. */ 216 const char *rl_terminal_name = (const char *)NULL; 217 218 /* Non-zero means to always use horizontal scrolling in line display. */ 219 int _rl_horizontal_scroll_mode = 0; 220 221 /* Non-zero means to display an asterisk at the starts of history lines 222 which have been modified. */ 223 int _rl_mark_modified_lines = 0; 224 225 /* The style of `bell' notification preferred. This can be set to NO_BELL, 226 AUDIBLE_BELL, or VISIBLE_BELL. */ 227 int _rl_bell_preference = AUDIBLE_BELL; 228 229 /* String inserted into the line by rl_insert_comment (). */ 230 char *_rl_comment_begin; 231 232 /* Keymap holding the function currently being executed. */ 233 Keymap rl_executing_keymap; 234 235 /* Keymap we're currently using to dispatch. */ 236 Keymap _rl_dispatching_keymap; 237 238 /* Non-zero means to erase entire line, including prompt, on empty input lines. */ 239 int rl_erase_empty_line = 0; 240 241 /* Non-zero means to read only this many characters rather than up to a 242 character bound to accept-line. */ 243 int rl_num_chars_to_read; 244 245 /* Line buffer and maintenance. */ 246 char *rl_line_buffer = (char *)NULL; 247 int rl_line_buffer_len = 0; 248 249 /* Key sequence `contexts' */ 250 _rl_keyseq_cxt *_rl_kscxt = 0; 251 252 int rl_executing_key; 253 char *rl_executing_keyseq = 0; 254 int _rl_executing_keyseq_size = 0; 255 256 /* Timeout (specified in milliseconds) when reading characters making up an 257 ambiguous multiple-key sequence */ 258 int _rl_keyseq_timeout = 500; 259 260 #define RESIZE_KEYSEQ_BUFFER() \ 261 do \ 262 { \ 263 if (rl_key_sequence_length + 2 >= _rl_executing_keyseq_size) \ 264 { \ 265 _rl_executing_keyseq_size += 16; \ 266 rl_executing_keyseq = xrealloc (rl_executing_keyseq, _rl_executing_keyseq_size); \ 267 } \ 268 } \ 269 while (0); 270 271 /* Forward declarations used by the display, termcap, and history code. */ 272 273 /* **************************************************************** */ 274 /* */ 275 /* `Forward' declarations */ 276 /* */ 277 /* **************************************************************** */ 278 279 /* Non-zero means do not parse any lines other than comments and 280 parser directives. */ 281 unsigned char _rl_parsing_conditionalized_out = 0; 282 283 /* Non-zero means to convert characters with the meta bit set to 284 escape-prefixed characters so we can indirect through 285 emacs_meta_keymap or vi_escape_keymap. */ 286 int _rl_convert_meta_chars_to_ascii = 1; 287 288 /* Non-zero means to output characters with the meta bit set directly 289 rather than as a meta-prefixed escape sequence. */ 290 int _rl_output_meta_chars = 0; 291 292 /* Non-zero means to look at the termios special characters and bind 293 them to equivalent readline functions at startup. */ 294 int _rl_bind_stty_chars = 1; 295 296 /* Non-zero means to go through the history list at every newline (or 297 whenever rl_done is set and readline returns) and revert each line to 298 its initial state. */ 299 int _rl_revert_all_at_newline = 0; 300 301 /* Non-zero means to honor the termios ECHOCTL bit and echo control 302 characters corresponding to keyboard-generated signals. */ 303 int _rl_echo_control_chars = 1; 304 305 /* Non-zero means to prefix the displayed prompt with a character indicating 306 the editing mode: @ for emacs, : for vi-command, + for vi-insert. */ 307 int _rl_show_mode_in_prompt = 0; 308 309 /* **************************************************************** */ 310 /* */ 311 /* Top Level Functions */ 312 /* */ 313 /* **************************************************************** */ 314 315 /* Non-zero means treat 0200 bit in terminal input as Meta bit. */ 316 int _rl_meta_flag = 0; /* Forward declaration */ 317 318 /* Set up the prompt and expand it. Called from readline() and 319 rl_callback_handler_install (). */ 320 int 321 rl_set_prompt (prompt) 322 const char *prompt; 323 { 324 FREE (rl_prompt); 325 rl_prompt = prompt ? savestring (prompt) : (char *)NULL; 326 rl_display_prompt = rl_prompt ? rl_prompt : ""; 327 328 rl_visible_prompt_length = rl_expand_prompt (rl_prompt); 329 return 0; 330 } 331 332 /* Read a line of input. Prompt with PROMPT. An empty PROMPT means 333 none. A return value of NULL means that EOF was encountered. */ 334 char * 335 readline (prompt) 336 const char *prompt; 337 { 338 char *value; 339 #if 0 340 int in_callback; 341 #endif 342 343 /* If we are at EOF return a NULL string. */ 344 if (rl_pending_input == EOF) 345 { 346 rl_clear_pending_input (); 347 return ((char *)NULL); 348 } 349 350 #if 0 351 /* If readline() is called after installing a callback handler, temporarily 352 turn off the callback state to avoid ensuing messiness. Patch supplied 353 by the gdb folks. XXX -- disabled. This can be fooled and readline 354 left in a strange state by a poorly-timed longjmp. */ 355 if (in_callback = RL_ISSTATE (RL_STATE_CALLBACK)) 356 RL_UNSETSTATE (RL_STATE_CALLBACK); 357 #endif 358 359 rl_set_prompt (prompt); 360 361 rl_initialize (); 362 if (rl_prep_term_function) 363 (*rl_prep_term_function) (_rl_meta_flag); 364 365 #if defined (HANDLE_SIGNALS) 366 rl_set_signals (); 367 #endif 368 369 value = readline_internal (); 370 if (rl_deprep_term_function) 371 (*rl_deprep_term_function) (); 372 373 #if defined (HANDLE_SIGNALS) 374 rl_clear_signals (); 375 #endif 376 377 #if 0 378 if (in_callback) 379 RL_SETSTATE (RL_STATE_CALLBACK); 380 #endif 381 382 #if HAVE_DECL_AUDIT_TTY && defined (ENABLE_TTY_AUDIT_SUPPORT) 383 if (value) 384 _rl_audit_tty (value); 385 #endif 386 387 return (value); 388 } 389 390 #if defined (READLINE_CALLBACKS) 391 # define STATIC_CALLBACK 392 #else 393 # define STATIC_CALLBACK static 394 #endif 395 396 STATIC_CALLBACK void 397 readline_internal_setup () 398 { 399 char *nprompt; 400 401 _rl_in_stream = rl_instream; 402 _rl_out_stream = rl_outstream; 403 404 /* Enable the meta key only for the duration of readline(), if this 405 terminal has one and the terminal has been initialized */ 406 if (_rl_enable_meta & RL_ISSTATE (RL_STATE_TERMPREPPED)) 407 _rl_enable_meta_key (); 408 409 if (rl_startup_hook) 410 (*rl_startup_hook) (); 411 412 #if defined (VI_MODE) 413 if (rl_editing_mode == vi_mode) 414 rl_vi_insertion_mode (1, 'i'); /* don't want to reset last */ 415 #endif /* VI_MODE */ 416 417 /* If we're not echoing, we still want to at least print a prompt, because 418 rl_redisplay will not do it for us. If the calling application has a 419 custom redisplay function, though, let that function handle it. */ 420 if (_rl_echoing_p == 0 && rl_redisplay_function == rl_redisplay) 421 { 422 if (rl_prompt && rl_already_prompted == 0) 423 { 424 nprompt = _rl_strip_prompt (rl_prompt); 425 fprintf (_rl_out_stream, "%s", nprompt); 426 fflush (_rl_out_stream); 427 xfree (nprompt); 428 } 429 } 430 else 431 { 432 if (rl_prompt && rl_already_prompted) 433 rl_on_new_line_with_prompt (); 434 else 435 rl_on_new_line (); 436 (*rl_redisplay_function) (); 437 } 438 439 if (rl_pre_input_hook) 440 (*rl_pre_input_hook) (); 441 442 RL_CHECK_SIGNALS (); 443 } 444 445 STATIC_CALLBACK char * 446 readline_internal_teardown (eof) 447 int eof; 448 { 449 char *temp; 450 HIST_ENTRY *entry; 451 452 RL_CHECK_SIGNALS (); 453 454 /* Restore the original of this history line, iff the line that we 455 are editing was originally in the history, AND the line has changed. */ 456 entry = current_history (); 457 458 if (entry && rl_undo_list) 459 { 460 temp = savestring (the_line); 461 rl_revert_line (1, 0); 462 entry = replace_history_entry (where_history (), the_line, (histdata_t)NULL); 463 _rl_free_history_entry (entry); 464 465 strcpy (the_line, temp); 466 xfree (temp); 467 } 468 469 if (_rl_revert_all_at_newline) 470 _rl_revert_all_lines (); 471 472 /* At any rate, it is highly likely that this line has an undo list. Get 473 rid of it now. */ 474 if (rl_undo_list) 475 rl_free_undo_list (); 476 477 /* Disable the meta key, if this terminal has one and we were told to use it. 478 The check whether or not we sent the enable string is in 479 _rl_disable_meta_key(); the flag is set in _rl_enable_meta_key */ 480 _rl_disable_meta_key (); 481 482 /* Restore normal cursor, if available. */ 483 _rl_set_insert_mode (RL_IM_INSERT, 0); 484 485 return (eof ? (char *)NULL : savestring (the_line)); 486 } 487 488 void 489 _rl_internal_char_cleanup () 490 { 491 #if defined (VI_MODE) 492 /* In vi mode, when you exit insert mode, the cursor moves back 493 over the previous character. We explicitly check for that here. */ 494 if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap) 495 rl_vi_check (); 496 #endif /* VI_MODE */ 497 498 if (rl_num_chars_to_read && rl_end >= rl_num_chars_to_read) 499 { 500 (*rl_redisplay_function) (); 501 _rl_want_redisplay = 0; 502 rl_newline (1, '\n'); 503 } 504 505 if (rl_done == 0) 506 { 507 (*rl_redisplay_function) (); 508 _rl_want_redisplay = 0; 509 } 510 511 /* If the application writer has told us to erase the entire line if 512 the only character typed was something bound to rl_newline, do so. */ 513 if (rl_erase_empty_line && rl_done && rl_last_func == rl_newline && 514 rl_point == 0 && rl_end == 0) 515 _rl_erase_entire_line (); 516 } 517 518 STATIC_CALLBACK int 519 #if defined (READLINE_CALLBACKS) 520 readline_internal_char () 521 #else 522 readline_internal_charloop () 523 #endif 524 { 525 static int lastc, eof_found; 526 int c, code, lk; 527 528 lastc = -1; 529 eof_found = 0; 530 531 #if !defined (READLINE_CALLBACKS) 532 while (rl_done == 0) 533 { 534 #endif 535 lk = _rl_last_command_was_kill; 536 537 #if defined (HAVE_POSIX_SIGSETJMP) 538 code = sigsetjmp (_rl_top_level, 0); 539 #else 540 code = setjmp (_rl_top_level); 541 #endif 542 543 if (code) 544 { 545 (*rl_redisplay_function) (); 546 _rl_want_redisplay = 0; 547 /* If we get here, we're not being called from something dispatched 548 from _rl_callback_read_char(), which sets up its own value of 549 _rl_top_level (saving and restoring the old, of course), so 550 we can just return here. */ 551 if (RL_ISSTATE (RL_STATE_CALLBACK)) 552 return (0); 553 } 554 555 if (rl_pending_input == 0) 556 { 557 /* Then initialize the argument and number of keys read. */ 558 _rl_reset_argument (); 559 rl_key_sequence_length = 0; 560 rl_executing_keyseq[0] = 0; 561 } 562 563 RL_SETSTATE(RL_STATE_READCMD); 564 c = rl_read_key (); 565 RL_UNSETSTATE(RL_STATE_READCMD); 566 567 /* look at input.c:rl_getc() for the circumstances under which this will 568 be returned; punt immediately on read error without converting it to 569 a newline; assume that rl_read_key has already called the signal 570 handler. */ 571 if (c == READERR) 572 { 573 #if defined (READLINE_CALLBACKS) 574 RL_SETSTATE(RL_STATE_DONE); 575 return (rl_done = 1); 576 #else 577 eof_found = 1; 578 break; 579 #endif 580 } 581 582 /* EOF typed to a non-blank line is a <NL>. If we want to change this, 583 to force any existing line to be ignored when read(2) reads EOF, 584 for example, this is the place to change. */ 585 if (c == EOF && rl_end) 586 c = NEWLINE; 587 588 /* The character _rl_eof_char typed to blank line, and not as the 589 previous character is interpreted as EOF. */ 590 if (((c == _rl_eof_char && lastc != c) || c == EOF) && !rl_end) 591 { 592 #if defined (READLINE_CALLBACKS) 593 RL_SETSTATE(RL_STATE_DONE); 594 return (rl_done = 1); 595 #else 596 eof_found = 1; 597 break; 598 #endif 599 } 600 601 lastc = c; 602 _rl_dispatch ((unsigned char)c, _rl_keymap); 603 RL_CHECK_SIGNALS (); 604 605 /* If there was no change in _rl_last_command_was_kill, then no kill 606 has taken place. Note that if input is pending we are reading 607 a prefix command, so nothing has changed yet. */ 608 if (rl_pending_input == 0 && lk == _rl_last_command_was_kill) 609 _rl_last_command_was_kill = 0; 610 611 _rl_internal_char_cleanup (); 612 613 #if defined (READLINE_CALLBACKS) 614 return 0; 615 #else 616 } 617 618 return (eof_found); 619 #endif 620 } 621 622 #if defined (READLINE_CALLBACKS) 623 static int 624 readline_internal_charloop () 625 { 626 int eof = 1; 627 628 while (rl_done == 0) 629 eof = readline_internal_char (); 630 return (eof); 631 } 632 #endif /* READLINE_CALLBACKS */ 633 634 /* Read a line of input from the global rl_instream, doing output on 635 the global rl_outstream. 636 If rl_prompt is non-null, then that is our prompt. */ 637 static char * 638 readline_internal () 639 { 640 int eof; 641 642 readline_internal_setup (); 643 eof = readline_internal_charloop (); 644 return (readline_internal_teardown (eof)); 645 } 646 647 void 648 _rl_init_line_state () 649 { 650 rl_point = rl_end = rl_mark = 0; 651 the_line = rl_line_buffer; 652 the_line[0] = 0; 653 } 654 655 void 656 _rl_set_the_line () 657 { 658 the_line = rl_line_buffer; 659 } 660 661 #if defined (READLINE_CALLBACKS) 662 _rl_keyseq_cxt * 663 _rl_keyseq_cxt_alloc () 664 { 665 _rl_keyseq_cxt *cxt; 666 667 cxt = (_rl_keyseq_cxt *)xmalloc (sizeof (_rl_keyseq_cxt)); 668 669 cxt->flags = cxt->subseq_arg = cxt->subseq_retval = 0; 670 671 cxt->okey = 0; 672 cxt->ocxt = _rl_kscxt; 673 cxt->childval = 42; /* sentinel value */ 674 675 return cxt; 676 } 677 678 void 679 _rl_keyseq_cxt_dispose (cxt) 680 _rl_keyseq_cxt *cxt; 681 { 682 xfree (cxt); 683 } 684 685 void 686 _rl_keyseq_chain_dispose () 687 { 688 _rl_keyseq_cxt *cxt; 689 690 while (_rl_kscxt) 691 { 692 cxt = _rl_kscxt; 693 _rl_kscxt = _rl_kscxt->ocxt; 694 _rl_keyseq_cxt_dispose (cxt); 695 } 696 } 697 #endif 698 699 static int 700 _rl_subseq_getchar (key) 701 int key; 702 { 703 int k; 704 705 if (key == ESC) 706 RL_SETSTATE(RL_STATE_METANEXT); 707 RL_SETSTATE(RL_STATE_MOREINPUT); 708 k = rl_read_key (); 709 RL_UNSETSTATE(RL_STATE_MOREINPUT); 710 if (key == ESC) 711 RL_UNSETSTATE(RL_STATE_METANEXT); 712 713 return k; 714 } 715 716 #if defined (READLINE_CALLBACKS) 717 int 718 _rl_dispatch_callback (cxt) 719 _rl_keyseq_cxt *cxt; 720 { 721 int nkey, r; 722 723 /* For now */ 724 /* The first time this context is used, we want to read input and dispatch 725 on it. When traversing the chain of contexts back `up', we want to use 726 the value from the next context down. We're simulating recursion using 727 a chain of contexts. */ 728 if ((cxt->flags & KSEQ_DISPATCHED) == 0) 729 { 730 nkey = _rl_subseq_getchar (cxt->okey); 731 if (nkey < 0) 732 { 733 _rl_abort_internal (); 734 return -1; 735 } 736 r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg); 737 cxt->flags |= KSEQ_DISPATCHED; 738 } 739 else 740 r = cxt->childval; 741 742 /* For now */ 743 if (r != -3) /* don't do this if we indicate there will be other matches */ 744 r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ)); 745 746 RL_CHECK_SIGNALS (); 747 /* We only treat values < 0 specially to simulate recursion. */ 748 if (r >= 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0)) /* success! or failure! */ 749 { 750 _rl_keyseq_chain_dispose (); 751 RL_UNSETSTATE (RL_STATE_MULTIKEY); 752 return r; 753 } 754 755 if (r != -3) /* magic value that says we added to the chain */ 756 _rl_kscxt = cxt->ocxt; 757 if (_rl_kscxt) 758 _rl_kscxt->childval = r; 759 if (r != -3) 760 _rl_keyseq_cxt_dispose (cxt); 761 762 return r; 763 } 764 #endif /* READLINE_CALLBACKS */ 765 766 /* Do the command associated with KEY in MAP. 767 If the associated command is really a keymap, then read 768 another key, and dispatch into that map. */ 769 int 770 _rl_dispatch (key, map) 771 register int key; 772 Keymap map; 773 { 774 _rl_dispatching_keymap = map; 775 return _rl_dispatch_subseq (key, map, 0); 776 } 777 778 int 779 _rl_dispatch_subseq (key, map, got_subseq) 780 register int key; 781 Keymap map; 782 int got_subseq; 783 { 784 int r, newkey; 785 char *macro; 786 rl_command_func_t *func; 787 #if defined (READLINE_CALLBACKS) 788 _rl_keyseq_cxt *cxt; 789 #endif 790 791 if (META_CHAR (key) && _rl_convert_meta_chars_to_ascii) 792 { 793 if (map[ESC].type == ISKMAP) 794 { 795 if (RL_ISSTATE (RL_STATE_MACRODEF)) 796 _rl_add_macro_char (ESC); 797 RESIZE_KEYSEQ_BUFFER (); 798 rl_executing_keyseq[rl_key_sequence_length++] = ESC; 799 map = FUNCTION_TO_KEYMAP (map, ESC); 800 key = UNMETA (key); 801 return (_rl_dispatch (key, map)); 802 } 803 else 804 rl_ding (); 805 return 0; 806 } 807 808 if (RL_ISSTATE (RL_STATE_MACRODEF)) 809 _rl_add_macro_char (key); 810 811 r = 0; 812 switch (map[key].type) 813 { 814 case ISFUNC: 815 func = map[key].function; 816 if (func) 817 { 818 /* Special case rl_do_lowercase_version (). */ 819 if (func == rl_do_lowercase_version) 820 /* Should we do anything special if key == ANYOTHERKEY? */ 821 return (_rl_dispatch (_rl_to_lower (key), map)); 822 823 rl_executing_keymap = map; 824 rl_executing_key = key; 825 826 RESIZE_KEYSEQ_BUFFER(); 827 rl_executing_keyseq[rl_key_sequence_length++] = key; 828 rl_executing_keyseq[rl_key_sequence_length] = '\0'; 829 830 rl_dispatching = 1; 831 RL_SETSTATE(RL_STATE_DISPATCHING); 832 r = (*func) (rl_numeric_arg * rl_arg_sign, key); 833 RL_UNSETSTATE(RL_STATE_DISPATCHING); 834 rl_dispatching = 0; 835 836 /* If we have input pending, then the last command was a prefix 837 command. Don't change the state of rl_last_func. Otherwise, 838 remember the last command executed in this variable. */ 839 if (rl_pending_input == 0 && map[key].function != rl_digit_argument) 840 rl_last_func = map[key].function; 841 842 RL_CHECK_SIGNALS (); 843 } 844 else if (map[ANYOTHERKEY].function) 845 { 846 /* OK, there's no function bound in this map, but there is a 847 shadow function that was overridden when the current keymap 848 was created. Return -2 to note that. */ 849 if (RL_ISSTATE (RL_STATE_MACROINPUT)) 850 _rl_prev_macro_key (); 851 else 852 _rl_unget_char (key); 853 return -2; 854 } 855 else if (got_subseq) 856 { 857 /* Return -1 to note that we're in a subsequence, but we don't 858 have a matching key, nor was one overridden. This means 859 we need to back up the recursion chain and find the last 860 subsequence that is bound to a function. */ 861 if (RL_ISSTATE (RL_STATE_MACROINPUT)) 862 _rl_prev_macro_key (); 863 else 864 _rl_unget_char (key); 865 return -1; 866 } 867 else 868 { 869 #if defined (READLINE_CALLBACKS) 870 RL_UNSETSTATE (RL_STATE_MULTIKEY); 871 _rl_keyseq_chain_dispose (); 872 #endif 873 _rl_abort_internal (); 874 return -1; 875 } 876 break; 877 878 case ISKMAP: 879 if (map[key].function != 0) 880 { 881 #if defined (VI_MODE) 882 /* The only way this test will be true is if a subsequence has been 883 bound starting with ESC, generally the arrow keys. What we do is 884 check whether there's input in the queue, which there generally 885 will be if an arrow key has been pressed, and, if there's not, 886 just dispatch to (what we assume is) rl_vi_movement_mode right 887 away. This is essentially an input test with a zero timeout (by 888 default) or a timeout determined by the value of `keyseq-timeout' */ 889 /* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued 890 takes microseconds, so multiply by 1000 */ 891 if (rl_editing_mode == vi_mode && key == ESC && map == vi_insertion_keymap 892 && _rl_input_queued ((_rl_keyseq_timeout > 0) ? _rl_keyseq_timeout*1000 : 0) == 0) 893 return (_rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key))); 894 #endif 895 896 RESIZE_KEYSEQ_BUFFER (); 897 rl_executing_keyseq[rl_key_sequence_length++] = key; 898 _rl_dispatching_keymap = FUNCTION_TO_KEYMAP (map, key); 899 900 /* Allocate new context here. Use linked contexts (linked through 901 cxt->ocxt) to simulate recursion */ 902 #if defined (READLINE_CALLBACKS) 903 if (RL_ISSTATE (RL_STATE_CALLBACK)) 904 { 905 /* Return 0 only the first time, to indicate success to 906 _rl_callback_read_char. The rest of the time, we're called 907 from _rl_dispatch_callback, so we return -3 to indicate 908 special handling is necessary. */ 909 r = RL_ISSTATE (RL_STATE_MULTIKEY) ? -3 : 0; 910 cxt = _rl_keyseq_cxt_alloc (); 911 912 if (got_subseq) 913 cxt->flags |= KSEQ_SUBSEQ; 914 cxt->okey = key; 915 cxt->oldmap = map; 916 cxt->dmap = _rl_dispatching_keymap; 917 cxt->subseq_arg = got_subseq || cxt->dmap[ANYOTHERKEY].function; 918 919 RL_SETSTATE (RL_STATE_MULTIKEY); 920 _rl_kscxt = cxt; 921 922 return r; /* don't indicate immediate success */ 923 } 924 #endif 925 926 /* Tentative inter-character timeout for potential multi-key 927 sequences? If no input within timeout, abort sequence and 928 act as if we got non-matching input. */ 929 /* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued 930 takes microseconds, so multiply by 1000 */ 931 if (_rl_keyseq_timeout > 0 && 932 (RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) && 933 _rl_pushed_input_available () == 0 && 934 _rl_dispatching_keymap[ANYOTHERKEY].function && 935 _rl_input_queued (_rl_keyseq_timeout*1000) == 0) 936 return (_rl_subseq_result (-2, map, key, got_subseq)); 937 938 newkey = _rl_subseq_getchar (key); 939 if (newkey < 0) 940 { 941 _rl_abort_internal (); 942 return -1; 943 } 944 945 r = _rl_dispatch_subseq (newkey, _rl_dispatching_keymap, got_subseq || map[ANYOTHERKEY].function); 946 return _rl_subseq_result (r, map, key, got_subseq); 947 } 948 else 949 { 950 _rl_abort_internal (); 951 return -1; 952 } 953 break; 954 955 case ISMACR: 956 if (map[key].function != 0) 957 { 958 rl_executing_keyseq[rl_key_sequence_length] = '\0'; 959 macro = savestring ((char *)map[key].function); 960 _rl_with_macro_input (macro); 961 return 0; 962 } 963 break; 964 } 965 #if defined (VI_MODE) 966 if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap && 967 key != ANYOTHERKEY && 968 rl_key_sequence_length == 1 && /* XXX */ 969 _rl_vi_textmod_command (key)) 970 _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign); 971 #endif 972 973 return (r); 974 } 975 976 static int 977 _rl_subseq_result (r, map, key, got_subseq) 978 int r; 979 Keymap map; 980 int key, got_subseq; 981 { 982 Keymap m; 983 int type, nt; 984 rl_command_func_t *func, *nf; 985 986 if (r == -2) 987 /* We didn't match anything, and the keymap we're indexed into 988 shadowed a function previously bound to that prefix. Call 989 the function. The recursive call to _rl_dispatch_subseq has 990 already taken care of pushing any necessary input back onto 991 the input queue with _rl_unget_char. */ 992 { 993 m = _rl_dispatching_keymap; 994 type = m[ANYOTHERKEY].type; 995 func = m[ANYOTHERKEY].function; 996 if (type == ISFUNC && func == rl_do_lowercase_version) 997 r = _rl_dispatch (_rl_to_lower (key), map); 998 else if (type == ISFUNC && func == rl_insert) 999 { 1000 /* If the function that was shadowed was self-insert, we 1001 somehow need a keymap with map[key].func == self-insert. 1002 Let's use this one. */ 1003 nt = m[key].type; 1004 nf = m[key].function; 1005 1006 m[key].type = type; 1007 m[key].function = func; 1008 r = _rl_dispatch (key, m); 1009 m[key].type = nt; 1010 m[key].function = nf; 1011 } 1012 else 1013 r = _rl_dispatch (ANYOTHERKEY, m); 1014 } 1015 else if (r && map[ANYOTHERKEY].function) 1016 { 1017 /* We didn't match (r is probably -1), so return something to 1018 tell the caller that it should try ANYOTHERKEY for an 1019 overridden function. */ 1020 if (RL_ISSTATE (RL_STATE_MACROINPUT)) 1021 _rl_prev_macro_key (); 1022 else 1023 _rl_unget_char (key); 1024 _rl_dispatching_keymap = map; 1025 return -2; 1026 } 1027 else if (r && got_subseq) 1028 { 1029 /* OK, back up the chain. */ 1030 if (RL_ISSTATE (RL_STATE_MACROINPUT)) 1031 _rl_prev_macro_key (); 1032 else 1033 _rl_unget_char (key); 1034 _rl_dispatching_keymap = map; 1035 return -1; 1036 } 1037 1038 return r; 1039 } 1040 1041 /* **************************************************************** */ 1042 /* */ 1043 /* Initializations */ 1044 /* */ 1045 /* **************************************************************** */ 1046 1047 /* Initialize readline (and terminal if not already). */ 1048 int 1049 rl_initialize () 1050 { 1051 /* If we have never been called before, initialize the 1052 terminal and data structures. */ 1053 if (!rl_initialized) 1054 { 1055 RL_SETSTATE(RL_STATE_INITIALIZING); 1056 readline_initialize_everything (); 1057 RL_UNSETSTATE(RL_STATE_INITIALIZING); 1058 rl_initialized++; 1059 RL_SETSTATE(RL_STATE_INITIALIZED); 1060 } 1061 1062 /* Initialize the current line information. */ 1063 _rl_init_line_state (); 1064 1065 /* We aren't done yet. We haven't even gotten started yet! */ 1066 rl_done = 0; 1067 RL_UNSETSTATE(RL_STATE_DONE); 1068 1069 /* Tell the history routines what is going on. */ 1070 _rl_start_using_history (); 1071 1072 /* Make the display buffer match the state of the line. */ 1073 rl_reset_line_state (); 1074 1075 /* No such function typed yet. */ 1076 rl_last_func = (rl_command_func_t *)NULL; 1077 1078 /* Parsing of key-bindings begins in an enabled state. */ 1079 _rl_parsing_conditionalized_out = 0; 1080 1081 #if defined (VI_MODE) 1082 if (rl_editing_mode == vi_mode) 1083 _rl_vi_initialize_line (); 1084 #endif 1085 1086 /* Each line starts in insert mode (the default). */ 1087 _rl_set_insert_mode (RL_IM_DEFAULT, 1); 1088 1089 return 0; 1090 } 1091 1092 #if 0 1093 #if defined (__EMX__) 1094 static void 1095 _emx_build_environ () 1096 { 1097 TIB *tibp; 1098 PIB *pibp; 1099 char *t, **tp; 1100 int c; 1101 1102 DosGetInfoBlocks (&tibp, &pibp); 1103 t = pibp->pib_pchenv; 1104 for (c = 1; *t; c++) 1105 t += strlen (t) + 1; 1106 tp = environ = (char **)xmalloc ((c + 1) * sizeof (char *)); 1107 t = pibp->pib_pchenv; 1108 while (*t) 1109 { 1110 *tp++ = t; 1111 t += strlen (t) + 1; 1112 } 1113 *tp = 0; 1114 } 1115 #endif /* __EMX__ */ 1116 #endif 1117 1118 /* Initialize the entire state of the world. */ 1119 static void 1120 readline_initialize_everything () 1121 { 1122 #if 0 1123 #if defined (__EMX__) 1124 if (environ == 0) 1125 _emx_build_environ (); 1126 #endif 1127 #endif 1128 1129 #if 0 1130 /* Find out if we are running in Emacs -- UNUSED. */ 1131 running_in_emacs = sh_get_env_value ("EMACS") != (char *)0; 1132 #endif 1133 1134 /* Set up input and output if they are not already set up. */ 1135 if (!rl_instream) 1136 rl_instream = stdin; 1137 1138 if (!rl_outstream) 1139 rl_outstream = stdout; 1140 1141 /* Bind _rl_in_stream and _rl_out_stream immediately. These values 1142 may change, but they may also be used before readline_internal () 1143 is called. */ 1144 _rl_in_stream = rl_instream; 1145 _rl_out_stream = rl_outstream; 1146 1147 /* Allocate data structures. */ 1148 if (rl_line_buffer == 0) 1149 rl_line_buffer = (char *)xmalloc (rl_line_buffer_len = DEFAULT_BUFFER_SIZE); 1150 1151 /* Initialize the terminal interface. */ 1152 if (rl_terminal_name == 0) 1153 rl_terminal_name = sh_get_env_value ("TERM"); 1154 _rl_init_terminal_io (rl_terminal_name); 1155 1156 /* Bind tty characters to readline functions. */ 1157 readline_default_bindings (); 1158 1159 /* Initialize the function names. */ 1160 rl_initialize_funmap (); 1161 1162 /* Decide whether we should automatically go into eight-bit mode. */ 1163 _rl_init_eightbit (); 1164 1165 /* Read in the init file. */ 1166 rl_read_init_file ((char *)NULL); 1167 1168 /* XXX */ 1169 if (_rl_horizontal_scroll_mode && _rl_term_autowrap) 1170 { 1171 _rl_screenwidth--; 1172 _rl_screenchars -= _rl_screenheight; 1173 } 1174 1175 /* Override the effect of any `set keymap' assignments in the 1176 inputrc file. */ 1177 rl_set_keymap_from_edit_mode (); 1178 1179 /* Try to bind a common arrow key prefix, if not already bound. */ 1180 bind_arrow_keys (); 1181 1182 /* If the completion parser's default word break characters haven't 1183 been set yet, then do so now. */ 1184 if (rl_completer_word_break_characters == (char *)NULL) 1185 rl_completer_word_break_characters = (char *)rl_basic_word_break_characters; 1186 1187 #if defined (COLOR_SUPPORT) 1188 if (_rl_colored_stats) 1189 _rl_parse_colors (); 1190 #endif 1191 1192 rl_executing_keyseq = malloc (_rl_executing_keyseq_size = 16); 1193 if (rl_executing_keyseq) 1194 rl_executing_keyseq[0] = '\0'; 1195 } 1196 1197 /* If this system allows us to look at the values of the regular 1198 input editing characters, then bind them to their readline 1199 equivalents, iff the characters are not bound to keymaps. */ 1200 static void 1201 readline_default_bindings () 1202 { 1203 if (_rl_bind_stty_chars) 1204 rl_tty_set_default_bindings (_rl_keymap); 1205 } 1206 1207 /* Reset the default bindings for the terminal special characters we're 1208 interested in back to rl_insert and read the new ones. */ 1209 static void 1210 reset_default_bindings () 1211 { 1212 if (_rl_bind_stty_chars) 1213 { 1214 rl_tty_unset_default_bindings (_rl_keymap); 1215 rl_tty_set_default_bindings (_rl_keymap); 1216 } 1217 } 1218 1219 /* Bind some common arrow key sequences in MAP. */ 1220 static void 1221 bind_arrow_keys_internal (map) 1222 Keymap map; 1223 { 1224 Keymap xkeymap; 1225 1226 xkeymap = _rl_keymap; 1227 _rl_keymap = map; 1228 1229 #if defined (__MSDOS__) 1230 rl_bind_keyseq_if_unbound ("\033[0A", rl_get_previous_history); 1231 rl_bind_keyseq_if_unbound ("\033[0B", rl_backward_char); 1232 rl_bind_keyseq_if_unbound ("\033[0C", rl_forward_char); 1233 rl_bind_keyseq_if_unbound ("\033[0D", rl_get_next_history); 1234 #endif 1235 1236 rl_bind_keyseq_if_unbound ("\033[A", rl_get_previous_history); 1237 rl_bind_keyseq_if_unbound ("\033[B", rl_get_next_history); 1238 rl_bind_keyseq_if_unbound ("\033[C", rl_forward_char); 1239 rl_bind_keyseq_if_unbound ("\033[D", rl_backward_char); 1240 rl_bind_keyseq_if_unbound ("\033[H", rl_beg_of_line); 1241 rl_bind_keyseq_if_unbound ("\033[F", rl_end_of_line); 1242 1243 rl_bind_keyseq_if_unbound ("\033OA", rl_get_previous_history); 1244 rl_bind_keyseq_if_unbound ("\033OB", rl_get_next_history); 1245 rl_bind_keyseq_if_unbound ("\033OC", rl_forward_char); 1246 rl_bind_keyseq_if_unbound ("\033OD", rl_backward_char); 1247 rl_bind_keyseq_if_unbound ("\033OH", rl_beg_of_line); 1248 rl_bind_keyseq_if_unbound ("\033OF", rl_end_of_line); 1249 1250 #if defined (__MINGW32__) 1251 rl_bind_keyseq_if_unbound ("\340H", rl_get_previous_history); 1252 rl_bind_keyseq_if_unbound ("\340P", rl_get_next_history); 1253 rl_bind_keyseq_if_unbound ("\340M", rl_forward_char); 1254 rl_bind_keyseq_if_unbound ("\340K", rl_backward_char); 1255 rl_bind_keyseq_if_unbound ("\340G", rl_beg_of_line); 1256 rl_bind_keyseq_if_unbound ("\340O", rl_end_of_line); 1257 rl_bind_keyseq_if_unbound ("\340S", rl_delete); 1258 rl_bind_keyseq_if_unbound ("\340R", rl_overwrite_mode); 1259 1260 /* These may or may not work because of the embedded NUL. */ 1261 rl_bind_keyseq_if_unbound ("\\000H", rl_get_previous_history); 1262 rl_bind_keyseq_if_unbound ("\\000P", rl_get_next_history); 1263 rl_bind_keyseq_if_unbound ("\\000M", rl_forward_char); 1264 rl_bind_keyseq_if_unbound ("\\000K", rl_backward_char); 1265 rl_bind_keyseq_if_unbound ("\\000G", rl_beg_of_line); 1266 rl_bind_keyseq_if_unbound ("\\000O", rl_end_of_line); 1267 rl_bind_keyseq_if_unbound ("\\000S", rl_delete); 1268 rl_bind_keyseq_if_unbound ("\\000R", rl_overwrite_mode); 1269 #endif 1270 1271 _rl_keymap = xkeymap; 1272 } 1273 1274 /* Try and bind the common arrow key prefixes after giving termcap and 1275 the inputrc file a chance to bind them and create `real' keymaps 1276 for the arrow key prefix. */ 1277 static void 1278 bind_arrow_keys () 1279 { 1280 bind_arrow_keys_internal (emacs_standard_keymap); 1281 1282 #if defined (VI_MODE) 1283 bind_arrow_keys_internal (vi_movement_keymap); 1284 /* Unbind vi_movement_keymap[ESC] to allow users to repeatedly hit ESC 1285 in vi command mode while still allowing the arrow keys to work. */ 1286 if (vi_movement_keymap[ESC].type == ISKMAP) 1287 rl_bind_keyseq_in_map ("\033", (rl_command_func_t *)NULL, vi_movement_keymap); 1288 bind_arrow_keys_internal (vi_insertion_keymap); 1289 #endif 1290 } 1291 1292 /* **************************************************************** */ 1293 /* */ 1294 /* Saving and Restoring Readline's state */ 1295 /* */ 1296 /* **************************************************************** */ 1297 1298 int 1299 rl_save_state (sp) 1300 struct readline_state *sp; 1301 { 1302 if (sp == 0) 1303 return -1; 1304 1305 sp->point = rl_point; 1306 sp->end = rl_end; 1307 sp->mark = rl_mark; 1308 sp->buffer = rl_line_buffer; 1309 sp->buflen = rl_line_buffer_len; 1310 sp->ul = rl_undo_list; 1311 sp->prompt = rl_prompt; 1312 1313 sp->rlstate = rl_readline_state; 1314 sp->done = rl_done; 1315 sp->kmap = _rl_keymap; 1316 1317 sp->lastfunc = rl_last_func; 1318 sp->insmode = rl_insert_mode; 1319 sp->edmode = rl_editing_mode; 1320 sp->kseqlen = rl_key_sequence_length; 1321 sp->inf = rl_instream; 1322 sp->outf = rl_outstream; 1323 sp->pendingin = rl_pending_input; 1324 sp->macro = rl_executing_macro; 1325 1326 sp->catchsigs = rl_catch_signals; 1327 sp->catchsigwinch = rl_catch_sigwinch; 1328 1329 return (0); 1330 } 1331 1332 int 1333 rl_restore_state (sp) 1334 struct readline_state *sp; 1335 { 1336 if (sp == 0) 1337 return -1; 1338 1339 rl_point = sp->point; 1340 rl_end = sp->end; 1341 rl_mark = sp->mark; 1342 the_line = rl_line_buffer = sp->buffer; 1343 rl_line_buffer_len = sp->buflen; 1344 rl_undo_list = sp->ul; 1345 rl_prompt = sp->prompt; 1346 1347 rl_readline_state = sp->rlstate; 1348 rl_done = sp->done; 1349 _rl_keymap = sp->kmap; 1350 1351 rl_last_func = sp->lastfunc; 1352 rl_insert_mode = sp->insmode; 1353 rl_editing_mode = sp->edmode; 1354 rl_key_sequence_length = sp->kseqlen; 1355 rl_instream = sp->inf; 1356 rl_outstream = sp->outf; 1357 rl_pending_input = sp->pendingin; 1358 rl_executing_macro = sp->macro; 1359 1360 rl_catch_signals = sp->catchsigs; 1361 rl_catch_sigwinch = sp->catchsigwinch; 1362 1363 return (0); 1364 } -
lib/sh/shquote.c
diff -Naur bash-4.3.orig/lib/sh/shquote.c bash-4.3/lib/sh/shquote.c
old new 311 311 312 312 return (0); 313 313 } 314 315 int 316 sh_contains_quotes (string) 317 char *string; 318 { 319 char *s; 320 321 for (s = string; s && *s; s++) 322 { 323 if (*s == '\'' || *s == '"' || *s == '\\') 324 return 1; 325 } 326 return 0; 327 } -
make_cmd.c
diff -Naur bash-4.3.orig/make_cmd.c bash-4.3/make_cmd.c
old new 692 692 /* First do the common cases. */ 693 693 temp->redirector = source; 694 694 temp->redirectee = dest_and_filename; 695 temp->here_doc_eof = 0; 695 696 temp->instruction = instruction; 696 697 temp->flags = 0; 697 698 temp->rflags = flags; -
parse.y
diff -Naur bash-4.3.orig/parse.y bash-4.3/parse.y
old new 168 168 169 169 static int reserved_word_acceptable __P((int)); 170 170 static int yylex __P((void)); 171 172 static void push_heredoc __P((REDIRECT *)); 173 static char *mk_alexpansion __P((char *)); 171 174 static int alias_expand_token __P((char *)); 172 175 static int time_command_acceptable __P((void)); 173 176 static int special_case_tokens __P((char *)); … … 265 268 266 269 /* Variables to manage the task of reading here documents, because we need to 267 270 defer the reading until after a complete command has been collected. */ 268 static REDIRECT *redir_stack[10]; 271 #define HEREDOC_MAX 16 272 273 static REDIRECT *redir_stack[HEREDOC_MAX]; 269 274 int need_here_doc; 270 275 271 276 /* Where shell input comes from. History expansion is performed on each … … 307 312 or `for WORD' begins. This is a nested command maximum, since the array 308 313 index is decremented after a case, select, or for command is parsed. */ 309 314 #define MAX_CASE_NEST 128 310 static int word_lineno[MAX_CASE_NEST ];315 static int word_lineno[MAX_CASE_NEST+1]; 311 316 static int word_top = -1; 312 317 313 318 /* If non-zero, it is the token that we want read_token to return … … 520 525 source.dest = 0; 521 526 redir.filename = $2; 522 527 $$ = make_redirection (source, r_reading_until, redir, 0); 523 redir_stack[need_here_doc++] = $$;528 push_heredoc ($$); 524 529 } 525 530 | NUMBER LESS_LESS WORD 526 531 { 527 532 source.dest = $1; 528 533 redir.filename = $3; 529 534 $$ = make_redirection (source, r_reading_until, redir, 0); 530 redir_stack[need_here_doc++] = $$;535 push_heredoc ($$); 531 536 } 532 537 | REDIR_WORD LESS_LESS WORD 533 538 { 534 539 source.filename = $1; 535 540 redir.filename = $3; 536 541 $$ = make_redirection (source, r_reading_until, redir, REDIR_VARASSIGN); 537 redir_stack[need_here_doc++] = $$;542 push_heredoc ($$); 538 543 } 539 544 | LESS_LESS_MINUS WORD 540 545 { 541 546 source.dest = 0; 542 547 redir.filename = $2; 543 548 $$ = make_redirection (source, r_deblank_reading_until, redir, 0); 544 redir_stack[need_here_doc++] = $$;549 push_heredoc ($$); 545 550 } 546 551 | NUMBER LESS_LESS_MINUS WORD 547 552 { 548 553 source.dest = $1; 549 554 redir.filename = $3; 550 555 $$ = make_redirection (source, r_deblank_reading_until, redir, 0); 551 redir_stack[need_here_doc++] = $$;556 push_heredoc ($$); 552 557 } 553 558 | REDIR_WORD LESS_LESS_MINUS WORD 554 559 { 555 560 source.filename = $1; 556 561 redir.filename = $3; 557 562 $$ = make_redirection (source, r_deblank_reading_until, redir, REDIR_VARASSIGN); 558 redir_stack[need_here_doc++] = $$;563 push_heredoc ($$); 559 564 } 560 565 | LESS_LESS_LESS WORD 561 566 { … … 2424 2429 not already end in an EOF character. */ 2425 2430 if (shell_input_line_terminator != EOF) 2426 2431 { 2427 if (shell_input_line_size < SIZE_MAX && shell_input_line_len > shell_input_line_size - 3)2432 if (shell_input_line_size < SIZE_MAX-3 && (shell_input_line_len+3 > shell_input_line_size)) 2428 2433 shell_input_line = (char *)xrealloc (shell_input_line, 2429 2434 1 + (shell_input_line_size += 2)); 2430 2435 … … 2533 2538 eol_ungetc_lookahead = c; 2534 2539 } 2535 2540 2541 char * 2542 parser_remaining_input () 2543 { 2544 if (shell_input_line == 0) 2545 return 0; 2546 if (shell_input_line_index < 0 || shell_input_line_index >= shell_input_line_len) 2547 return '\0'; /* XXX */ 2548 return (shell_input_line + shell_input_line_index); 2549 } 2550 2536 2551 #ifdef INCLUDE_UNUSED 2537 2552 /* Back the input pointer up by one, effectively `ungetting' a character. */ 2538 2553 static void … … 2636 2651 which allow ESAC to be the next one read. */ 2637 2652 static int esacs_needed_count; 2638 2653 2654 static void 2655 push_heredoc (r) 2656 REDIRECT *r; 2657 { 2658 if (need_here_doc >= HEREDOC_MAX) 2659 { 2660 last_command_exit_value = EX_BADUSAGE; 2661 need_here_doc = 0; 2662 report_syntax_error (_("maximum here-document count exceeded")); 2663 reset_parser (); 2664 exit_shell (last_command_exit_value); 2665 } 2666 redir_stack[need_here_doc++] = r; 2667 } 2668 2639 2669 void 2640 2670 gather_here_documents () 2641 2671 { 2642 2672 int r; 2643 2673 2644 2674 r = 0; 2645 while (need_here_doc )2675 while (need_here_doc > 0) 2646 2676 { 2647 2677 parser_state |= PST_HEREDOC; 2648 2678 make_here_document (redir_stack[r++], line_number); … … 2953 2983 FREE (word_desc_to_read); 2954 2984 word_desc_to_read = (WORD_DESC *)NULL; 2955 2985 2986 eol_ungetc_lookahead = 0; 2987 2956 2988 current_token = '\n'; /* XXX */ 2957 2989 last_read_token = '\n'; 2958 2990 token_to_read = '\n'; … … 3398 3430 within a double-quoted ${...} construct "an even number of 3399 3431 unescaped double-quotes or single-quotes, if any, shall occur." */ 3400 3432 /* This was changed in Austin Group Interp 221 */ 3401 if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'')3433 if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && dolbrace_state != DOLBRACE_QUOTE2 && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'') 3402 3434 continue; 3403 3435 3404 3436 /* Could also check open == '`' if we want to parse grouping constructs … … 4005 4037 reset_parser (); 4006 4038 /* reset_parser clears shell_input_line and associated variables */ 4007 4039 restore_input_line_state (&ls); 4008 if (interactive) 4009 4040 4041 token_to_read = 0; 4010 4042 4011 4043 /* Need to find how many characters parse_and_execute consumed, update 4012 4044 *indp, if flags != 0, copy the portion of the string parsed into RET … … 6075 6107 6076 6108 ps->expand_aliases = expand_aliases; 6077 6109 ps->echo_input_at_read = echo_input_at_read; 6110 ps->need_here_doc = need_here_doc; 6078 6111 6079 6112 ps->token = token; 6080 6113 ps->token_buffer_size = token_buffer_size; … … 6123 6156 6124 6157 expand_aliases = ps->expand_aliases; 6125 6158 echo_input_at_read = ps->echo_input_at_read; 6159 need_here_doc = ps->need_here_doc; 6126 6160 6127 6161 FREE (token); 6128 6162 token = ps->token; -
patchlevel.h
diff -Naur bash-4.3.orig/patchlevel.h bash-4.3/patchlevel.h
old new 25 25 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh 26 26 looks for to find the patch level (for the sccs version string). */ 27 27 28 #define PATCHLEVEL 028 #define PATCHLEVEL 30 29 29 30 30 #endif /* _PATCHLEVEL_H_ */ -
pcomplete.c
diff -Naur bash-4.3.orig/pcomplete.c bash-4.3/pcomplete.c
old new 183 183 184 184 COMPSPEC *pcomp_curcs; 185 185 const char *pcomp_curcmd; 186 const char *pcomp_curtxt; 186 187 187 188 #ifdef DEBUG 188 189 /* Debugging code */ … … 753 754 quoted strings. */ 754 755 dfn = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character); 755 756 } 757 /* Intended to solve a mismatched assumption by bash-completion. If 758 the text to be completed is empty, but bash-completion turns it into 759 a quoted string ('') assuming that this code will dequote it before 760 calling readline, do the dequoting. */ 761 else if (iscompgen && iscompleting && 762 pcomp_curtxt && *pcomp_curtxt == 0 && 763 text && (*text == '\'' || *text == '"') && text[1] == text[0] && text[2] == 0 && 764 rl_filename_dequoting_function) 765 dfn = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character); 766 /* Another mismatched assumption by bash-completion. If compgen is being 767 run as part of bash-completion, and the argument to compgen is not 768 the same as the word originally passed to the programmable completion 769 code, dequote the argument if it has quote characters. It's an 770 attempt to detect when bash-completion is quoting its filename 771 argument before calling compgen. */ 772 /* We could check whether gen_shell_function_matches is in the call 773 stack by checking whether the gen-shell-function-matches tag is in 774 the unwind-protect stack, but there's no function to do that yet. 775 We could simply check whether we're executing in a function by 776 checking variable_context, and may end up doing that. */ 777 else if (iscompgen && iscompleting && rl_filename_dequoting_function && 778 pcomp_curtxt && text && 779 STREQ (pcomp_curtxt, text) == 0 && 780 variable_context && 781 sh_contains_quotes (text)) /* guess */ 782 dfn = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character); 756 783 else 757 784 dfn = savestring (text); 758 785 } … … 1522 1549 COMPSPEC **lastcs; 1523 1550 { 1524 1551 COMPSPEC *cs, *oldcs; 1525 const char *oldcmd ;1552 const char *oldcmd, *oldtxt; 1526 1553 STRINGLIST *ret; 1527 1554 1528 1555 cs = progcomp_search (ocmd); … … 1545 1572 1546 1573 oldcs = pcomp_curcs; 1547 1574 oldcmd = pcomp_curcmd; 1575 oldtxt = pcomp_curtxt; 1548 1576 1549 1577 pcomp_curcs = cs; 1550 1578 pcomp_curcmd = cmd; 1579 pcomp_curtxt = word; 1551 1580 1552 1581 ret = gen_compspec_completions (cs, cmd, word, start, end, foundp); 1553 1582 1554 1583 pcomp_curcs = oldcs; 1555 1584 pcomp_curcmd = oldcmd; 1585 pcomp_curtxt = oldtxt; 1556 1586 1557 1587 /* We need to conditionally handle setting *retryp here */ 1558 1588 if (retryp) -
shell.h
diff -Naur bash-4.3.orig/shell.h bash-4.3/shell.h
old new 168 168 /* flags state affecting the parser */ 169 169 int expand_aliases; 170 170 int echo_input_at_read; 171 171 int need_here_doc; 172 172 173 } sh_parser_state_t; 173 174 174 175 typedef struct _sh_input_line_state_t { … … 179 180 } sh_input_line_state_t; 180 181 181 182 /* Let's try declaring these here. */ 183 extern char *parser_remaining_input __P((void)); 184 182 185 extern sh_parser_state_t *save_parser_state __P((sh_parser_state_t *)); 183 186 extern void restore_parser_state __P((sh_parser_state_t *)); 184 187 -
subst.c
diff -Naur bash-4.3.orig/subst.c bash-4.3/subst.c
old new 1192 1192 Start extracting at (SINDEX) as if we had just seen "<(". 1193 1193 Make (SINDEX) get the position of the matching ")". */ /*))*/ 1194 1194 char * 1195 extract_process_subst (string, starter, sindex )1195 extract_process_subst (string, starter, sindex, xflags) 1196 1196 char *string; 1197 1197 char *starter; 1198 1198 int *sindex; 1199 int xflags; 1199 1200 { 1201 #if 0 1200 1202 return (extract_delimited_string (string, sindex, starter, "(", ")", SX_COMMAND)); 1203 #else 1204 xflags |= (no_longjmp_on_fatal_error ? SX_NOLONGJMP : 0); 1205 return (xparse_dolparen (string, string+*sindex, sindex, xflags)); 1206 #endif 1201 1207 } 1202 1208 #endif /* PROCESS_SUBSTITUTION */ 1203 1209 … … 1785 1791 si = i + 2; 1786 1792 if (string[si] == '\0') 1787 1793 CQ_RETURN(si); 1788 temp = extract_process_subst (string, (c == '<') ? "<(" : ">(", &si );1794 temp = extract_process_subst (string, (c == '<') ? "<(" : ">(", &si, 0); 1789 1795 free (temp); /* no SX_ALLOC here */ 1790 1796 i = si; 1791 1797 if (string[i] == '\0') … … 3248 3254 if (w->word == 0 || w->word[0] == '\0') 3249 3255 return ((char *)NULL); 3250 3256 3257 expand_no_split_dollar_star = 1; 3251 3258 w->flags |= W_NOSPLIT2; 3252 3259 l = call_expand_word_internal (w, 0, 0, (int *)0, (int *)0); 3260 expand_no_split_dollar_star = 0; 3253 3261 if (l) 3254 3262 { 3255 3263 if (special == 0) /* LHS */ … … 7366 7374 } 7367 7375 7368 7376 if (want_indir) 7369 tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at); 7377 { 7378 tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at); 7379 /* Turn off the W_ARRAYIND flag because there is no way for this function 7380 to return the index we're supposed to be using. */ 7381 if (tdesc && tdesc->flags) 7382 tdesc->flags &= ~W_ARRAYIND; 7383 } 7370 7384 else 7371 7385 tdesc = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND|(pflags&(PF_NOSPLIT2|PF_ASSIGNRHS)), &ind); 7372 7386 … … 7847 7861 We also want to make sure that splitting is done no matter what -- 7848 7862 according to POSIX.2, this expands to a list of the positional 7849 7863 parameters no matter what IFS is set to. */ 7864 /* XXX - what to do when in a context where word splitting is not 7865 performed? Even when IFS is not the default, posix seems to imply 7866 that we behave like unquoted $* ? Maybe we should use PF_NOSPLIT2 7867 here. */ 7850 7868 temp = string_list_dollar_at (list, (pflags & PF_ASSIGNRHS) ? (quoted|Q_DOUBLE_QUOTES) : quoted); 7851 7869 7852 7870 tflag |= W_DOLLARAT; … … 8029 8047 8030 8048 goto return0; 8031 8049 } 8032 else if (var = find_variable_last_nameref (temp1)) 8050 else if (var && (invisible_p (var) || var_isset (var) == 0)) 8051 temp = (char *)NULL; 8052 else if ((var = find_variable_last_nameref (temp1)) && var_isset (var) && invisible_p (var) == 0) 8033 8053 { 8034 8054 temp = nameref_cell (var); 8035 8055 #if defined (ARRAY_VARS) … … 8243 8263 else 8244 8264 t_index = sindex + 1; /* skip past both '<' and LPAREN */ 8245 8265 8246 temp1 = extract_process_subst (string, (c == '<') ? "<(" : ">(", &t_index ); /*))*/8266 temp1 = extract_process_subst (string, (c == '<') ? "<(" : ">(", &t_index, 0); /*))*/ 8247 8267 sindex = t_index; 8248 8268 8249 8269 /* If the process substitution specification is `<()', we want to … … 8816 8836 else 8817 8837 { 8818 8838 char *ifs_chars; 8839 char *tstring; 8819 8840 8820 8841 ifs_chars = (quoted_dollar_at || has_dollar_at) ? ifs_value : (char *)NULL; 8821 8842 … … 8830 8851 regardless of what else has happened to IFS since the expansion. */ 8831 8852 if (split_on_spaces) 8832 8853 list = list_string (istring, " ", 1); /* XXX quoted == 1? */ 8854 /* If we have $@ (has_dollar_at != 0) and we are in a context where we 8855 don't want to split the result (W_NOSPLIT2), and we are not quoted, 8856 we have already separated the arguments with the first character of 8857 $IFS. In this case, we want to return a list with a single word 8858 with the separator possibly replaced with a space (it's what other 8859 shells seem to do). 8860 quoted_dollar_at is internal to this function and is set if we are 8861 passed an argument that is unquoted (quoted == 0) but we encounter a 8862 double-quoted $@ while expanding it. */ 8863 else if (has_dollar_at && quoted_dollar_at == 0 && ifs_chars && quoted == 0 && (word->flags & W_NOSPLIT2)) 8864 { 8865 /* Only split and rejoin if we have to */ 8866 if (*ifs_chars && *ifs_chars != ' ') 8867 { 8868 list = list_string (istring, *ifs_chars ? ifs_chars : " ", 1); 8869 tstring = string_list (list); 8870 } 8871 else 8872 tstring = istring; 8873 tword = make_bare_word (tstring); 8874 if (tstring != istring) 8875 free (tstring); 8876 goto set_word_flags; 8877 } 8833 8878 else if (has_dollar_at && ifs_chars) 8834 8879 list = list_string (istring, *ifs_chars ? ifs_chars : " ", 1); 8835 8880 else 8836 8881 { 8837 8882 tword = make_bare_word (istring); 8883 set_word_flags: 8838 8884 if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) || (quoted_state == WHOLLY_QUOTED)) 8839 8885 tword->flags |= W_QUOTED; 8840 8886 if (word->flags & W_ASSIGNMENT) -
subst.h
diff -Naur bash-4.3.orig/subst.h bash-4.3/subst.h
old new 82 82 /* Extract the <( or >( construct in STRING, and return a new string. 83 83 Start extracting at (SINDEX) as if we had just seen "<(". 84 84 Make (SINDEX) get the position just after the matching ")". */ 85 extern char *extract_process_subst __P((char *, char *, int * ));85 extern char *extract_process_subst __P((char *, char *, int *, int)); 86 86 #endif /* PROCESS_SUBSTITUTION */ 87 87 88 88 /* Extract the name of the variable to bind to from the assignment string. */ -
bash-4.3
diff -Naur bash-4.3.orig/test.c bash-4.3/test.c
old new 646 646 return (v && invisible_p (v) == 0 && var_isset (v) ? TRUE : FALSE); 647 647 648 648 case 'R': 649 v = find_variable (arg);650 return ( v && invisible_p (v) == 0 && var_isset (v) && nameref_p (v) ? TRUE : FALSE);649 v = find_variable_noref (arg); 650 return ((v && invisible_p (v) == 0 && var_isset (v) && nameref_p (v)) ? TRUE : FALSE); 651 651 } 652 652 653 653 /* We can't actually get here, but this shuts up gcc. */ … … 723 723 case 'o': case 'p': case 'r': case 's': case 't': 724 724 case 'u': case 'v': case 'w': case 'x': case 'z': 725 725 case 'G': case 'L': case 'O': case 'S': case 'N': 726 case 'R': 726 727 return (1); 727 728 } 728 729 -
bash-4.3
diff -Naur bash-4.3.orig/trap.c bash-4.3/trap.c
old new 920 920 subst_assign_varlist = 0; 921 921 922 922 #if defined (JOB_CONTROL) 923 save_pipeline (1); /* XXX only provides one save level */ 923 if (sig != DEBUG_TRAP) /* run_debug_trap does this */ 924 save_pipeline (1); /* XXX only provides one save level */ 924 925 #endif 925 926 926 927 /* If we're in a function, make sure return longjmps come here, too. */ … … 940 941 trap_exit_value = last_command_exit_value; 941 942 942 943 #if defined (JOB_CONTROL) 943 restore_pipeline (1); 944 if (sig != DEBUG_TRAP) /* run_debug_trap does this */ 945 restore_pipeline (1); 944 946 #endif 945 947 946 948 subst_assign_varlist = save_subst_varlist; -
variables.c
diff -Naur bash-4.3.orig/variables.c bash-4.3/variables.c
old new 83 83 84 84 #define ifsname(s) ((s)[0] == 'I' && (s)[1] == 'F' && (s)[2] == 'S' && (s)[3] == '\0') 85 85 86 #define BASHFUNC_PREFIX "BASH_FUNC_" 87 #define BASHFUNC_PREFLEN 10 /* == strlen(BASHFUNC_PREFIX */ 88 #define BASHFUNC_SUFFIX "%%" 89 #define BASHFUNC_SUFFLEN 2 /* == strlen(BASHFUNC_SUFFIX) */ 90 86 91 extern char **environ; 87 92 88 93 /* Variables used here and defined in other files. */ … … 279 284 static void propagate_temp_var __P((PTR_T)); 280 285 static void dispose_temporary_env __P((sh_free_func_t *)); 281 286 282 static inline char *mk_env_string __P((const char *, const char * ));287 static inline char *mk_env_string __P((const char *, const char *, int)); 283 288 static char **make_env_array_from_var_list __P((SHELL_VAR **)); 284 289 static char **make_var_export_array __P((VAR_CONTEXT *)); 285 290 static char **make_func_export_array __P((void)); … … 349 354 350 355 /* If exported function, define it now. Don't import functions from 351 356 the environment in privileged mode. */ 352 if (privmode == 0 && read_but_dont_execute == 0 && STREQN ("() {", string, 4)) 357 if (privmode == 0 && read_but_dont_execute == 0 && 358 STREQN (BASHFUNC_PREFIX, name, BASHFUNC_PREFLEN) && 359 STREQ (BASHFUNC_SUFFIX, name + char_index - BASHFUNC_SUFFLEN) && 360 STREQN ("() {", string, 4)) 353 361 { 354 s tring_length = strlen (string);355 temp_string = (char *)xmalloc (3 + string_length + char_index);362 size_t namelen; 363 char *tname; /* desired imported function name */ 356 364 357 strcpy (temp_string, name); 358 temp_string[char_index] = ' '; 359 strcpy (temp_string + char_index + 1, string); 365 namelen = char_index - BASHFUNC_PREFLEN - BASHFUNC_SUFFLEN; 360 366 361 if (posixly_correct == 0 || legal_identifier (name)) 362 parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST); 367 tname = name + BASHFUNC_PREFLEN; /* start of func name */ 368 tname[namelen] = '\0'; /* now tname == func name */ 369 370 string_length = strlen (string); 371 temp_string = (char *)xmalloc (namelen + string_length + 2); 363 372 364 /* Ancient backwards compatibility. Old versions of bash exported 365 functions like name()=() {...} */ 366 if (name[char_index - 1] == ')' && name[char_index - 2] == '(') 367 name[char_index - 2] = '\0'; 373 memcpy (temp_string, tname, namelen); 374 temp_string[namelen] = ' '; 375 memcpy (temp_string + namelen + 1, string, string_length + 1); 376 377 /* Don't import function names that are invalid identifiers from the 378 environment, though we still allow them to be defined as shell 379 variables. */ 380 if (absolute_program (tname) == 0 && (posixly_correct == 0 || legal_identifier (tname))) 381 parse_and_execute (temp_string, tname, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_FUNCDEF|SEVAL_ONECMD); 368 382 369 if (temp_var = find_function ( name))383 if (temp_var = find_function (tname)) 370 384 { 371 385 VSETATTR (temp_var, (att_exported|att_imported)); 372 386 array_needs_making = 1; … … 379 393 array_needs_making = 1; 380 394 } 381 395 last_command_exit_value = 1; 382 report_error (_("error importing function definition for `%s'"), name);396 report_error (_("error importing function definition for `%s'"), tname); 383 397 } 384 398 385 /* ( */ 386 if (name[char_index - 1] == ')' && name[char_index - 2] == '\0') 387 name[char_index - 2] = '('; /* ) */ 399 /* Restore original suffix */ 400 tname[namelen] = BASHFUNC_SUFFIX[0]; 388 401 } 389 402 #if defined (ARRAY_VARS) 390 403 # if ARRAY_EXPORT … … 2197 2210 /* local foo; local foo; is a no-op. */ 2198 2211 old_var = find_variable (name); 2199 2212 if (old_var && local_p (old_var) && old_var->context == variable_context) 2200 { 2201 VUNSETATTR (old_var, att_invisible); /* XXX */ 2202 return (old_var); 2203 } 2213 return (old_var); 2204 2214 2205 2215 was_tmpvar = old_var && tempvar_p (old_var); 2206 2216 /* If we're making a local variable in a shell function, the temporary env … … 2963 2973 var->context = variable_context; /* XXX */ 2964 2974 2965 2975 INVALIDATE_EXPORTSTR (var); 2966 var->exportstr = mk_env_string (name, value );2976 var->exportstr = mk_env_string (name, value, 0); 2967 2977 2968 2978 array_needs_making = 1; 2969 2979 … … 3861 3871 /* **************************************************************** */ 3862 3872 3863 3873 static inline char * 3864 mk_env_string (name, value )3874 mk_env_string (name, value, isfunc) 3865 3875 const char *name, *value; 3876 int isfunc; 3866 3877 { 3867 int name_len, value_len;3868 char *p ;3878 size_t name_len, value_len; 3879 char *p, *q; 3869 3880 3870 3881 name_len = strlen (name); 3871 3882 value_len = STRLEN (value); 3872 p = (char *)xmalloc (2 + name_len + value_len); 3873 strcpy (p, name); 3874 p[name_len] = '='; 3883 3884 /* If we are exporting a shell function, construct the encoded function 3885 name. */ 3886 if (isfunc && value) 3887 { 3888 p = (char *)xmalloc (BASHFUNC_PREFLEN + name_len + BASHFUNC_SUFFLEN + value_len + 2); 3889 q = p; 3890 memcpy (q, BASHFUNC_PREFIX, BASHFUNC_PREFLEN); 3891 q += BASHFUNC_PREFLEN; 3892 memcpy (q, name, name_len); 3893 q += name_len; 3894 memcpy (q, BASHFUNC_SUFFIX, BASHFUNC_SUFFLEN); 3895 q += BASHFUNC_SUFFLEN; 3896 } 3897 else 3898 { 3899 p = (char *)xmalloc (2 + name_len + value_len); 3900 memcpy (p, name, name_len); 3901 q = p + name_len; 3902 } 3903 3904 q[0] = '='; 3875 3905 if (value && *value) 3876 strcpy (p + name_len + 1, value);3906 memcpy (q + 1, value, value_len + 1); 3877 3907 else 3878 p[name_len + 1] = '\0'; 3908 q[1] = '\0'; 3909 3879 3910 return (p); 3880 3911 } 3881 3912 … … 3961 3992 /* Gee, I'd like to get away with not using savestring() if we're 3962 3993 using the cached exportstr... */ 3963 3994 list[list_index] = USE_EXPORTSTR ? savestring (value) 3964 : mk_env_string (var->name, value );3995 : mk_env_string (var->name, value, function_p (var)); 3965 3996 3966 3997 if (USE_EXPORTSTR == 0) 3967 3998 SAVE_EXPORTSTR (var, list[list_index]); -
y.tab.c
diff -Naur bash-4.3.orig/y.tab.c bash-4.3/y.tab.c
old new 168 168 169 169 170 170 /* Copy the first part of user declarations. */ 171 #line 21 "/usr/ homes/chet/src/bash/src/parse.y"171 #line 21 "/usr/src/local/bash/bash-4.3-patched/parse.y" 172 172 173 173 #include "config.h" 174 174 … … 319 319 320 320 static int reserved_word_acceptable __P((int)); 321 321 static int yylex __P((void)); 322 323 static void push_heredoc __P((REDIRECT *)); 324 static char *mk_alexpansion __P((char *)); 322 325 static int alias_expand_token __P((char *)); 323 326 static int time_command_acceptable __P((void)); 324 327 static int special_case_tokens __P((char *)); … … 416 419 417 420 /* Variables to manage the task of reading here documents, because we need to 418 421 defer the reading until after a complete command has been collected. */ 419 static REDIRECT *redir_stack[10]; 422 #define HEREDOC_MAX 16 423 424 static REDIRECT *redir_stack[HEREDOC_MAX]; 420 425 int need_here_doc; 421 426 422 427 /* Where shell input comes from. History expansion is performed on each … … 458 463 or `for WORD' begins. This is a nested command maximum, since the array 459 464 index is decremented after a case, select, or for command is parsed. */ 460 465 #define MAX_CASE_NEST 128 461 static int word_lineno[MAX_CASE_NEST ];466 static int word_lineno[MAX_CASE_NEST+1]; 462 467 static int word_top = -1; 463 468 464 469 /* If non-zero, it is the token that we want read_token to return … … 492 497 493 498 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 494 499 typedef union YYSTYPE 495 #line 32 4 "/usr/homes/chet/src/bash/src/parse.y"500 #line 329 "/usr/src/local/bash/bash-4.3-patched/parse.y" 496 501 { 497 502 WORD_DESC *word; /* the word that we read. */ 498 503 int number; /* the number that we read. */ … … 503 508 PATTERN_LIST *pattern; 504 509 } 505 510 /* Line 193 of yacc.c. */ 506 #line 5 07"y.tab.c"511 #line 512 "y.tab.c" 507 512 YYSTYPE; 508 513 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 509 514 # define YYSTYPE_IS_DECLARED 1 … … 516 521 517 522 518 523 /* Line 216 of yacc.c. */ 519 #line 52 0"y.tab.c"524 #line 525 "y.tab.c" 520 525 521 526 #ifdef short 522 527 # undef short … … 886 891 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 887 892 static const yytype_uint16 yyrline[] = 888 893 { 889 0, 3 77, 377, 388, 397, 412, 422, 424, 428, 434,890 44 0, 446, 452, 458, 464, 470, 476, 482, 488, 494,891 50 0, 506, 512, 518, 525, 532, 539, 546, 553, 560,892 5 66, 572, 578, 584, 590, 596, 602, 608, 614, 620,893 6 26, 632, 638, 644, 650, 656, 662, 668, 674, 680,894 6 86, 692, 700, 702, 704, 708, 712, 723, 725, 729,895 73 1, 733, 749, 751, 755, 757, 759, 761, 763, 765,896 7 67, 769, 771, 773, 775, 779, 784, 789, 794, 799,897 80 4, 809, 814, 821, 826, 831, 836, 843, 848, 853,898 8 58, 863, 868, 875, 880, 885, 892, 895, 898, 902,899 90 4, 935, 942, 947, 964, 969, 986, 993, 995, 997,900 100 2, 1006, 1010, 1014, 1016, 1018, 1022, 1023, 1027, 1029,901 103 1, 1033, 1037, 1039, 1041, 1043, 1045, 1047, 1051, 1053,902 106 2, 1070, 1071, 1077, 1078, 1085, 1089, 1091, 1093, 1100,903 110 2, 1104, 1108, 1109, 1112, 1114, 1116, 1120, 1121, 1130,904 114 3, 1159, 1174, 1176, 1178, 1185, 1188, 1192, 1194, 1200,905 12 06, 1223, 1243, 1245, 1268, 1272, 1274, 1276894 0, 382, 382, 393, 402, 417, 427, 429, 433, 439, 895 445, 451, 457, 463, 469, 475, 481, 487, 493, 499, 896 505, 511, 517, 523, 530, 537, 544, 551, 558, 565, 897 571, 577, 583, 589, 595, 601, 607, 613, 619, 625, 898 631, 637, 643, 649, 655, 661, 667, 673, 679, 685, 899 691, 697, 705, 707, 709, 713, 717, 728, 730, 734, 900 736, 738, 754, 756, 760, 762, 764, 766, 768, 770, 901 772, 774, 776, 778, 780, 784, 789, 794, 799, 804, 902 809, 814, 819, 826, 831, 836, 841, 848, 853, 858, 903 863, 868, 873, 880, 885, 890, 897, 900, 903, 907, 904 909, 940, 947, 952, 969, 974, 991, 998, 1000, 1002, 905 1007, 1011, 1015, 1019, 1021, 1023, 1027, 1028, 1032, 1034, 906 1036, 1038, 1042, 1044, 1046, 1048, 1050, 1052, 1056, 1058, 907 1067, 1075, 1076, 1082, 1083, 1090, 1094, 1096, 1098, 1105, 908 1107, 1109, 1113, 1114, 1117, 1119, 1121, 1125, 1126, 1135, 909 1148, 1164, 1179, 1181, 1183, 1190, 1193, 1197, 1199, 1205, 910 1211, 1228, 1248, 1250, 1273, 1277, 1279, 1281 906 911 }; 907 912 #endif 908 913 … … 2093 2098 switch (yyn) 2094 2099 { 2095 2100 case 2: 2096 #line 3 78 "/usr/homes/chet/src/bash/src/parse.y"2101 #line 383 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2097 2102 { 2098 2103 /* Case of regular command. Discard the error 2099 2104 safety net,and return the command just parsed. */ … … 2107 2112 break; 2108 2113 2109 2114 case 3: 2110 #line 3 89 "/usr/homes/chet/src/bash/src/parse.y"2115 #line 394 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2111 2116 { 2112 2117 /* Case of regular command, but not a very 2113 2118 interesting one. Return a NULL command. */ … … 2119 2124 break; 2120 2125 2121 2126 case 4: 2122 #line 398 "/usr/homes/chet/src/bash/src/parse.y"2127 #line 403 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2123 2128 { 2124 2129 /* Error during parsing. Return NULL command. */ 2125 2130 global_command = (COMMAND *)NULL; … … 2137 2142 break; 2138 2143 2139 2144 case 5: 2140 #line 41 3 "/usr/homes/chet/src/bash/src/parse.y"2145 #line 418 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2141 2146 { 2142 2147 /* Case of EOF seen by itself. Do ignoreeof or 2143 2148 not. */ … … 2148 2153 break; 2149 2154 2150 2155 case 6: 2151 #line 42 3 "/usr/homes/chet/src/bash/src/parse.y"2156 #line 428 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2152 2157 { (yyval.word_list) = make_word_list ((yyvsp[(1) - (1)].word), (WORD_LIST *)NULL); } 2153 2158 break; 2154 2159 2155 2160 case 7: 2156 #line 4 25 "/usr/homes/chet/src/bash/src/parse.y"2161 #line 430 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2157 2162 { (yyval.word_list) = make_word_list ((yyvsp[(2) - (2)].word), (yyvsp[(1) - (2)].word_list)); } 2158 2163 break; 2159 2164 2160 2165 case 8: 2161 #line 4 29 "/usr/homes/chet/src/bash/src/parse.y"2166 #line 434 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2162 2167 { 2163 2168 source.dest = 1; 2164 2169 redir.filename = (yyvsp[(2) - (2)].word); … … 2167 2172 break; 2168 2173 2169 2174 case 9: 2170 #line 4 35 "/usr/homes/chet/src/bash/src/parse.y"2175 #line 440 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2171 2176 { 2172 2177 source.dest = 0; 2173 2178 redir.filename = (yyvsp[(2) - (2)].word); … … 2176 2181 break; 2177 2182 2178 2183 case 10: 2179 #line 44 1 "/usr/homes/chet/src/bash/src/parse.y"2184 #line 446 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2180 2185 { 2181 2186 source.dest = (yyvsp[(1) - (3)].number); 2182 2187 redir.filename = (yyvsp[(3) - (3)].word); … … 2185 2190 break; 2186 2191 2187 2192 case 11: 2188 #line 4 47 "/usr/homes/chet/src/bash/src/parse.y"2193 #line 452 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2189 2194 { 2190 2195 source.dest = (yyvsp[(1) - (3)].number); 2191 2196 redir.filename = (yyvsp[(3) - (3)].word); … … 2194 2199 break; 2195 2200 2196 2201 case 12: 2197 #line 45 3 "/usr/homes/chet/src/bash/src/parse.y"2202 #line 458 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2198 2203 { 2199 2204 source.filename = (yyvsp[(1) - (3)].word); 2200 2205 redir.filename = (yyvsp[(3) - (3)].word); … … 2203 2208 break; 2204 2209 2205 2210 case 13: 2206 #line 4 59 "/usr/homes/chet/src/bash/src/parse.y"2211 #line 464 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2207 2212 { 2208 2213 source.filename = (yyvsp[(1) - (3)].word); 2209 2214 redir.filename = (yyvsp[(3) - (3)].word); … … 2212 2217 break; 2213 2218 2214 2219 case 14: 2215 #line 4 65 "/usr/homes/chet/src/bash/src/parse.y"2220 #line 470 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2216 2221 { 2217 2222 source.dest = 1; 2218 2223 redir.filename = (yyvsp[(2) - (2)].word); … … 2221 2226 break; 2222 2227 2223 2228 case 15: 2224 #line 47 1 "/usr/homes/chet/src/bash/src/parse.y"2229 #line 476 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2225 2230 { 2226 2231 source.dest = (yyvsp[(1) - (3)].number); 2227 2232 redir.filename = (yyvsp[(3) - (3)].word); … … 2230 2235 break; 2231 2236 2232 2237 case 16: 2233 #line 4 77 "/usr/homes/chet/src/bash/src/parse.y"2238 #line 482 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2234 2239 { 2235 2240 source.filename = (yyvsp[(1) - (3)].word); 2236 2241 redir.filename = (yyvsp[(3) - (3)].word); … … 2239 2244 break; 2240 2245 2241 2246 case 17: 2242 #line 48 3 "/usr/homes/chet/src/bash/src/parse.y"2247 #line 488 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2243 2248 { 2244 2249 source.dest = 1; 2245 2250 redir.filename = (yyvsp[(2) - (2)].word); … … 2248 2253 break; 2249 2254 2250 2255 case 18: 2251 #line 4 89 "/usr/homes/chet/src/bash/src/parse.y"2256 #line 494 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2252 2257 { 2253 2258 source.dest = (yyvsp[(1) - (3)].number); 2254 2259 redir.filename = (yyvsp[(3) - (3)].word); … … 2257 2262 break; 2258 2263 2259 2264 case 19: 2260 #line 495 "/usr/homes/chet/src/bash/src/parse.y"2265 #line 500 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2261 2266 { 2262 2267 source.filename = (yyvsp[(1) - (3)].word); 2263 2268 redir.filename = (yyvsp[(3) - (3)].word); … … 2266 2271 break; 2267 2272 2268 2273 case 20: 2269 #line 50 1 "/usr/homes/chet/src/bash/src/parse.y"2274 #line 506 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2270 2275 { 2271 2276 source.dest = 0; 2272 2277 redir.filename = (yyvsp[(2) - (2)].word); … … 2275 2280 break; 2276 2281 2277 2282 case 21: 2278 #line 5 07 "/usr/homes/chet/src/bash/src/parse.y"2283 #line 512 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2279 2284 { 2280 2285 source.dest = (yyvsp[(1) - (3)].number); 2281 2286 redir.filename = (yyvsp[(3) - (3)].word); … … 2284 2289 break; 2285 2290 2286 2291 case 22: 2287 #line 51 3 "/usr/homes/chet/src/bash/src/parse.y"2292 #line 518 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2288 2293 { 2289 2294 source.filename = (yyvsp[(1) - (3)].word); 2290 2295 redir.filename = (yyvsp[(3) - (3)].word); … … 2293 2298 break; 2294 2299 2295 2300 case 23: 2296 #line 5 19 "/usr/homes/chet/src/bash/src/parse.y"2301 #line 524 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2297 2302 { 2298 2303 source.dest = 0; 2299 2304 redir.filename = (yyvsp[(2) - (2)].word); 2300 2305 (yyval.redirect) = make_redirection (source, r_reading_until, redir, 0); 2301 redir_stack[need_here_doc++] = (yyval.redirect);2306 push_heredoc ((yyval.redirect)); 2302 2307 } 2303 2308 break; 2304 2309 2305 2310 case 24: 2306 #line 5 26 "/usr/homes/chet/src/bash/src/parse.y"2311 #line 531 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2307 2312 { 2308 2313 source.dest = (yyvsp[(1) - (3)].number); 2309 2314 redir.filename = (yyvsp[(3) - (3)].word); 2310 2315 (yyval.redirect) = make_redirection (source, r_reading_until, redir, 0); 2311 redir_stack[need_here_doc++] = (yyval.redirect);2316 push_heredoc ((yyval.redirect)); 2312 2317 } 2313 2318 break; 2314 2319 2315 2320 case 25: 2316 #line 53 3 "/usr/homes/chet/src/bash/src/parse.y"2321 #line 538 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2317 2322 { 2318 2323 source.filename = (yyvsp[(1) - (3)].word); 2319 2324 redir.filename = (yyvsp[(3) - (3)].word); 2320 2325 (yyval.redirect) = make_redirection (source, r_reading_until, redir, REDIR_VARASSIGN); 2321 redir_stack[need_here_doc++] = (yyval.redirect);2326 push_heredoc ((yyval.redirect)); 2322 2327 } 2323 2328 break; 2324 2329 2325 2330 case 26: 2326 #line 54 0 "/usr/homes/chet/src/bash/src/parse.y"2331 #line 545 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2327 2332 { 2328 2333 source.dest = 0; 2329 2334 redir.filename = (yyvsp[(2) - (2)].word); 2330 2335 (yyval.redirect) = make_redirection (source, r_deblank_reading_until, redir, 0); 2331 redir_stack[need_here_doc++] = (yyval.redirect);2336 push_heredoc ((yyval.redirect)); 2332 2337 } 2333 2338 break; 2334 2339 2335 2340 case 27: 2336 #line 5 47 "/usr/homes/chet/src/bash/src/parse.y"2341 #line 552 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2337 2342 { 2338 2343 source.dest = (yyvsp[(1) - (3)].number); 2339 2344 redir.filename = (yyvsp[(3) - (3)].word); 2340 2345 (yyval.redirect) = make_redirection (source, r_deblank_reading_until, redir, 0); 2341 redir_stack[need_here_doc++] = (yyval.redirect);2346 push_heredoc ((yyval.redirect)); 2342 2347 } 2343 2348 break; 2344 2349 2345 2350 case 28: 2346 #line 55 4 "/usr/homes/chet/src/bash/src/parse.y"2351 #line 559 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2347 2352 { 2348 2353 source.filename = (yyvsp[(1) - (3)].word); 2349 2354 redir.filename = (yyvsp[(3) - (3)].word); 2350 2355 (yyval.redirect) = make_redirection (source, r_deblank_reading_until, redir, REDIR_VARASSIGN); 2351 redir_stack[need_here_doc++] = (yyval.redirect);2356 push_heredoc ((yyval.redirect)); 2352 2357 } 2353 2358 break; 2354 2359 2355 2360 case 29: 2356 #line 56 1 "/usr/homes/chet/src/bash/src/parse.y"2361 #line 566 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2357 2362 { 2358 2363 source.dest = 0; 2359 2364 redir.filename = (yyvsp[(2) - (2)].word); … … 2362 2367 break; 2363 2368 2364 2369 case 30: 2365 #line 5 67 "/usr/homes/chet/src/bash/src/parse.y"2370 #line 572 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2366 2371 { 2367 2372 source.dest = (yyvsp[(1) - (3)].number); 2368 2373 redir.filename = (yyvsp[(3) - (3)].word); … … 2371 2376 break; 2372 2377 2373 2378 case 31: 2374 #line 57 3 "/usr/homes/chet/src/bash/src/parse.y"2379 #line 578 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2375 2380 { 2376 2381 source.filename = (yyvsp[(1) - (3)].word); 2377 2382 redir.filename = (yyvsp[(3) - (3)].word); … … 2380 2385 break; 2381 2386 2382 2387 case 32: 2383 #line 5 79 "/usr/homes/chet/src/bash/src/parse.y"2388 #line 584 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2384 2389 { 2385 2390 source.dest = 0; 2386 2391 redir.dest = (yyvsp[(2) - (2)].number); … … 2389 2394 break; 2390 2395 2391 2396 case 33: 2392 #line 5 85 "/usr/homes/chet/src/bash/src/parse.y"2397 #line 590 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2393 2398 { 2394 2399 source.dest = (yyvsp[(1) - (3)].number); 2395 2400 redir.dest = (yyvsp[(3) - (3)].number); … … 2398 2403 break; 2399 2404 2400 2405 case 34: 2401 #line 59 1 "/usr/homes/chet/src/bash/src/parse.y"2406 #line 596 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2402 2407 { 2403 2408 source.filename = (yyvsp[(1) - (3)].word); 2404 2409 redir.dest = (yyvsp[(3) - (3)].number); … … 2407 2412 break; 2408 2413 2409 2414 case 35: 2410 #line 597 "/usr/homes/chet/src/bash/src/parse.y"2415 #line 602 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2411 2416 { 2412 2417 source.dest = 1; 2413 2418 redir.dest = (yyvsp[(2) - (2)].number); … … 2416 2421 break; 2417 2422 2418 2423 case 36: 2419 #line 60 3 "/usr/homes/chet/src/bash/src/parse.y"2424 #line 608 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2420 2425 { 2421 2426 source.dest = (yyvsp[(1) - (3)].number); 2422 2427 redir.dest = (yyvsp[(3) - (3)].number); … … 2425 2430 break; 2426 2431 2427 2432 case 37: 2428 #line 6 09 "/usr/homes/chet/src/bash/src/parse.y"2433 #line 614 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2429 2434 { 2430 2435 source.filename = (yyvsp[(1) - (3)].word); 2431 2436 redir.dest = (yyvsp[(3) - (3)].number); … … 2434 2439 break; 2435 2440 2436 2441 case 38: 2437 #line 6 15 "/usr/homes/chet/src/bash/src/parse.y"2442 #line 620 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2438 2443 { 2439 2444 source.dest = 0; 2440 2445 redir.filename = (yyvsp[(2) - (2)].word); … … 2443 2448 break; 2444 2449 2445 2450 case 39: 2446 #line 62 1 "/usr/homes/chet/src/bash/src/parse.y"2451 #line 626 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2447 2452 { 2448 2453 source.dest = (yyvsp[(1) - (3)].number); 2449 2454 redir.filename = (yyvsp[(3) - (3)].word); … … 2452 2457 break; 2453 2458 2454 2459 case 40: 2455 #line 6 27 "/usr/homes/chet/src/bash/src/parse.y"2460 #line 632 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2456 2461 { 2457 2462 source.filename = (yyvsp[(1) - (3)].word); 2458 2463 redir.filename = (yyvsp[(3) - (3)].word); … … 2461 2466 break; 2462 2467 2463 2468 case 41: 2464 #line 63 3 "/usr/homes/chet/src/bash/src/parse.y"2469 #line 638 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2465 2470 { 2466 2471 source.dest = 1; 2467 2472 redir.filename = (yyvsp[(2) - (2)].word); … … 2470 2475 break; 2471 2476 2472 2477 case 42: 2473 #line 6 39 "/usr/homes/chet/src/bash/src/parse.y"2478 #line 644 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2474 2479 { 2475 2480 source.dest = (yyvsp[(1) - (3)].number); 2476 2481 redir.filename = (yyvsp[(3) - (3)].word); … … 2479 2484 break; 2480 2485 2481 2486 case 43: 2482 #line 6 45 "/usr/homes/chet/src/bash/src/parse.y"2487 #line 650 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2483 2488 { 2484 2489 source.filename = (yyvsp[(1) - (3)].word); 2485 2490 redir.filename = (yyvsp[(3) - (3)].word); … … 2488 2493 break; 2489 2494 2490 2495 case 44: 2491 #line 65 1 "/usr/homes/chet/src/bash/src/parse.y"2496 #line 656 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2492 2497 { 2493 2498 source.dest = 1; 2494 2499 redir.dest = 0; … … 2497 2502 break; 2498 2503 2499 2504 case 45: 2500 #line 6 57 "/usr/homes/chet/src/bash/src/parse.y"2505 #line 662 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2501 2506 { 2502 2507 source.dest = (yyvsp[(1) - (3)].number); 2503 2508 redir.dest = 0; … … 2506 2511 break; 2507 2512 2508 2513 case 46: 2509 #line 66 3 "/usr/homes/chet/src/bash/src/parse.y"2514 #line 668 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2510 2515 { 2511 2516 source.filename = (yyvsp[(1) - (3)].word); 2512 2517 redir.dest = 0; … … 2515 2520 break; 2516 2521 2517 2522 case 47: 2518 #line 6 69 "/usr/homes/chet/src/bash/src/parse.y"2523 #line 674 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2519 2524 { 2520 2525 source.dest = 0; 2521 2526 redir.dest = 0; … … 2524 2529 break; 2525 2530 2526 2531 case 48: 2527 #line 6 75 "/usr/homes/chet/src/bash/src/parse.y"2532 #line 680 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2528 2533 { 2529 2534 source.dest = (yyvsp[(1) - (3)].number); 2530 2535 redir.dest = 0; … … 2533 2538 break; 2534 2539 2535 2540 case 49: 2536 #line 68 1 "/usr/homes/chet/src/bash/src/parse.y"2541 #line 686 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2537 2542 { 2538 2543 source.filename = (yyvsp[(1) - (3)].word); 2539 2544 redir.dest = 0; … … 2542 2547 break; 2543 2548 2544 2549 case 50: 2545 #line 6 87 "/usr/homes/chet/src/bash/src/parse.y"2550 #line 692 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2546 2551 { 2547 2552 source.dest = 1; 2548 2553 redir.filename = (yyvsp[(2) - (2)].word); … … 2551 2556 break; 2552 2557 2553 2558 case 51: 2554 #line 69 3 "/usr/homes/chet/src/bash/src/parse.y"2559 #line 698 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2555 2560 { 2556 2561 source.dest = 1; 2557 2562 redir.filename = (yyvsp[(2) - (2)].word); … … 2560 2565 break; 2561 2566 2562 2567 case 52: 2563 #line 70 1 "/usr/homes/chet/src/bash/src/parse.y"2568 #line 706 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2564 2569 { (yyval.element).word = (yyvsp[(1) - (1)].word); (yyval.element).redirect = 0; } 2565 2570 break; 2566 2571 2567 2572 case 53: 2568 #line 70 3 "/usr/homes/chet/src/bash/src/parse.y"2573 #line 708 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2569 2574 { (yyval.element).word = (yyvsp[(1) - (1)].word); (yyval.element).redirect = 0; } 2570 2575 break; 2571 2576 2572 2577 case 54: 2573 #line 7 05 "/usr/homes/chet/src/bash/src/parse.y"2578 #line 710 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2574 2579 { (yyval.element).redirect = (yyvsp[(1) - (1)].redirect); (yyval.element).word = 0; } 2575 2580 break; 2576 2581 2577 2582 case 55: 2578 #line 7 09 "/usr/homes/chet/src/bash/src/parse.y"2583 #line 714 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2579 2584 { 2580 2585 (yyval.redirect) = (yyvsp[(1) - (1)].redirect); 2581 2586 } 2582 2587 break; 2583 2588 2584 2589 case 56: 2585 #line 71 3 "/usr/homes/chet/src/bash/src/parse.y"2590 #line 718 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2586 2591 { 2587 2592 register REDIRECT *t; 2588 2593 … … 2594 2599 break; 2595 2600 2596 2601 case 57: 2597 #line 72 4 "/usr/homes/chet/src/bash/src/parse.y"2602 #line 729 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2598 2603 { (yyval.command) = make_simple_command ((yyvsp[(1) - (1)].element), (COMMAND *)NULL); } 2599 2604 break; 2600 2605 2601 2606 case 58: 2602 #line 7 26 "/usr/homes/chet/src/bash/src/parse.y"2607 #line 731 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2603 2608 { (yyval.command) = make_simple_command ((yyvsp[(2) - (2)].element), (yyvsp[(1) - (2)].command)); } 2604 2609 break; 2605 2610 2606 2611 case 59: 2607 #line 73 0 "/usr/homes/chet/src/bash/src/parse.y"2612 #line 735 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2608 2613 { (yyval.command) = clean_simple_command ((yyvsp[(1) - (1)].command)); } 2609 2614 break; 2610 2615 2611 2616 case 60: 2612 #line 73 2 "/usr/homes/chet/src/bash/src/parse.y"2617 #line 737 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2613 2618 { (yyval.command) = (yyvsp[(1) - (1)].command); } 2614 2619 break; 2615 2620 2616 2621 case 61: 2617 #line 73 4 "/usr/homes/chet/src/bash/src/parse.y"2622 #line 739 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2618 2623 { 2619 2624 COMMAND *tc; 2620 2625 … … 2633 2638 break; 2634 2639 2635 2640 case 62: 2636 #line 75 0 "/usr/homes/chet/src/bash/src/parse.y"2641 #line 755 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2637 2642 { (yyval.command) = (yyvsp[(1) - (1)].command); } 2638 2643 break; 2639 2644 2640 2645 case 63: 2641 #line 75 2 "/usr/homes/chet/src/bash/src/parse.y"2646 #line 757 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2642 2647 { (yyval.command) = (yyvsp[(1) - (1)].command); } 2643 2648 break; 2644 2649 2645 2650 case 64: 2646 #line 7 56 "/usr/homes/chet/src/bash/src/parse.y"2651 #line 761 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2647 2652 { (yyval.command) = (yyvsp[(1) - (1)].command); } 2648 2653 break; 2649 2654 2650 2655 case 65: 2651 #line 7 58 "/usr/homes/chet/src/bash/src/parse.y"2656 #line 763 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2652 2657 { (yyval.command) = (yyvsp[(1) - (1)].command); } 2653 2658 break; 2654 2659 2655 2660 case 66: 2656 #line 76 0 "/usr/homes/chet/src/bash/src/parse.y"2661 #line 765 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2657 2662 { (yyval.command) = make_while_command ((yyvsp[(2) - (5)].command), (yyvsp[(4) - (5)].command)); } 2658 2663 break; 2659 2664 2660 2665 case 67: 2661 #line 76 2 "/usr/homes/chet/src/bash/src/parse.y"2666 #line 767 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2662 2667 { (yyval.command) = make_until_command ((yyvsp[(2) - (5)].command), (yyvsp[(4) - (5)].command)); } 2663 2668 break; 2664 2669 2665 2670 case 68: 2666 #line 76 4 "/usr/homes/chet/src/bash/src/parse.y"2671 #line 769 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2667 2672 { (yyval.command) = (yyvsp[(1) - (1)].command); } 2668 2673 break; 2669 2674 2670 2675 case 69: 2671 #line 7 66 "/usr/homes/chet/src/bash/src/parse.y"2676 #line 771 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2672 2677 { (yyval.command) = (yyvsp[(1) - (1)].command); } 2673 2678 break; 2674 2679 2675 2680 case 70: 2676 #line 7 68 "/usr/homes/chet/src/bash/src/parse.y"2681 #line 773 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2677 2682 { (yyval.command) = (yyvsp[(1) - (1)].command); } 2678 2683 break; 2679 2684 2680 2685 case 71: 2681 #line 77 0 "/usr/homes/chet/src/bash/src/parse.y"2686 #line 775 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2682 2687 { (yyval.command) = (yyvsp[(1) - (1)].command); } 2683 2688 break; 2684 2689 2685 2690 case 72: 2686 #line 77 2 "/usr/homes/chet/src/bash/src/parse.y"2691 #line 777 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2687 2692 { (yyval.command) = (yyvsp[(1) - (1)].command); } 2688 2693 break; 2689 2694 2690 2695 case 73: 2691 #line 77 4 "/usr/homes/chet/src/bash/src/parse.y"2696 #line 779 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2692 2697 { (yyval.command) = (yyvsp[(1) - (1)].command); } 2693 2698 break; 2694 2699 2695 2700 case 74: 2696 #line 7 76 "/usr/homes/chet/src/bash/src/parse.y"2701 #line 781 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2697 2702 { (yyval.command) = (yyvsp[(1) - (1)].command); } 2698 2703 break; 2699 2704 2700 2705 case 75: 2701 #line 78 0 "/usr/homes/chet/src/bash/src/parse.y"2706 #line 785 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2702 2707 { 2703 2708 (yyval.command) = make_for_command ((yyvsp[(2) - (6)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(5) - (6)].command), word_lineno[word_top]); 2704 2709 if (word_top > 0) word_top--; … … 2706 2711 break; 2707 2712 2708 2713 case 76: 2709 #line 7 85 "/usr/homes/chet/src/bash/src/parse.y"2714 #line 790 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2710 2715 { 2711 2716 (yyval.command) = make_for_command ((yyvsp[(2) - (6)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(5) - (6)].command), word_lineno[word_top]); 2712 2717 if (word_top > 0) word_top--; … … 2714 2719 break; 2715 2720 2716 2721 case 77: 2717 #line 79 0 "/usr/homes/chet/src/bash/src/parse.y"2722 #line 795 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2718 2723 { 2719 2724 (yyval.command) = make_for_command ((yyvsp[(2) - (7)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(6) - (7)].command), word_lineno[word_top]); 2720 2725 if (word_top > 0) word_top--; … … 2722 2727 break; 2723 2728 2724 2729 case 78: 2725 #line 795 "/usr/homes/chet/src/bash/src/parse.y"2730 #line 800 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2726 2731 { 2727 2732 (yyval.command) = make_for_command ((yyvsp[(2) - (7)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(6) - (7)].command), word_lineno[word_top]); 2728 2733 if (word_top > 0) word_top--; … … 2730 2735 break; 2731 2736 2732 2737 case 79: 2733 #line 80 0 "/usr/homes/chet/src/bash/src/parse.y"2738 #line 805 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2734 2739 { 2735 2740 (yyval.command) = make_for_command ((yyvsp[(2) - (10)].word), REVERSE_LIST ((yyvsp[(5) - (10)].word_list), WORD_LIST *), (yyvsp[(9) - (10)].command), word_lineno[word_top]); 2736 2741 if (word_top > 0) word_top--; … … 2738 2743 break; 2739 2744 2740 2745 case 80: 2741 #line 8 05 "/usr/homes/chet/src/bash/src/parse.y"2746 #line 810 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2742 2747 { 2743 2748 (yyval.command) = make_for_command ((yyvsp[(2) - (10)].word), REVERSE_LIST ((yyvsp[(5) - (10)].word_list), WORD_LIST *), (yyvsp[(9) - (10)].command), word_lineno[word_top]); 2744 2749 if (word_top > 0) word_top--; … … 2746 2751 break; 2747 2752 2748 2753 case 81: 2749 #line 81 0 "/usr/homes/chet/src/bash/src/parse.y"2754 #line 815 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2750 2755 { 2751 2756 (yyval.command) = make_for_command ((yyvsp[(2) - (9)].word), (WORD_LIST *)NULL, (yyvsp[(8) - (9)].command), word_lineno[word_top]); 2752 2757 if (word_top > 0) word_top--; … … 2754 2759 break; 2755 2760 2756 2761 case 82: 2757 #line 8 15 "/usr/homes/chet/src/bash/src/parse.y"2762 #line 820 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2758 2763 { 2759 2764 (yyval.command) = make_for_command ((yyvsp[(2) - (9)].word), (WORD_LIST *)NULL, (yyvsp[(8) - (9)].command), word_lineno[word_top]); 2760 2765 if (word_top > 0) word_top--; … … 2762 2767 break; 2763 2768 2764 2769 case 83: 2765 #line 82 2 "/usr/homes/chet/src/bash/src/parse.y"2770 #line 827 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2766 2771 { 2767 2772 (yyval.command) = make_arith_for_command ((yyvsp[(2) - (7)].word_list), (yyvsp[(6) - (7)].command), arith_for_lineno); 2768 2773 if (word_top > 0) word_top--; … … 2770 2775 break; 2771 2776 2772 2777 case 84: 2773 #line 8 27 "/usr/homes/chet/src/bash/src/parse.y"2778 #line 832 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2774 2779 { 2775 2780 (yyval.command) = make_arith_for_command ((yyvsp[(2) - (7)].word_list), (yyvsp[(6) - (7)].command), arith_for_lineno); 2776 2781 if (word_top > 0) word_top--; … … 2778 2783 break; 2779 2784 2780 2785 case 85: 2781 #line 83 2 "/usr/homes/chet/src/bash/src/parse.y"2786 #line 837 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2782 2787 { 2783 2788 (yyval.command) = make_arith_for_command ((yyvsp[(2) - (5)].word_list), (yyvsp[(4) - (5)].command), arith_for_lineno); 2784 2789 if (word_top > 0) word_top--; … … 2786 2791 break; 2787 2792 2788 2793 case 86: 2789 #line 8 37 "/usr/homes/chet/src/bash/src/parse.y"2794 #line 842 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2790 2795 { 2791 2796 (yyval.command) = make_arith_for_command ((yyvsp[(2) - (5)].word_list), (yyvsp[(4) - (5)].command), arith_for_lineno); 2792 2797 if (word_top > 0) word_top--; … … 2794 2799 break; 2795 2800 2796 2801 case 87: 2797 #line 84 4 "/usr/homes/chet/src/bash/src/parse.y"2802 #line 849 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2798 2803 { 2799 2804 (yyval.command) = make_select_command ((yyvsp[(2) - (6)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(5) - (6)].command), word_lineno[word_top]); 2800 2805 if (word_top > 0) word_top--; … … 2802 2807 break; 2803 2808 2804 2809 case 88: 2805 #line 8 49 "/usr/homes/chet/src/bash/src/parse.y"2810 #line 854 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2806 2811 { 2807 2812 (yyval.command) = make_select_command ((yyvsp[(2) - (6)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(5) - (6)].command), word_lineno[word_top]); 2808 2813 if (word_top > 0) word_top--; … … 2810 2815 break; 2811 2816 2812 2817 case 89: 2813 #line 85 4 "/usr/homes/chet/src/bash/src/parse.y"2818 #line 859 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2814 2819 { 2815 2820 (yyval.command) = make_select_command ((yyvsp[(2) - (7)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(6) - (7)].command), word_lineno[word_top]); 2816 2821 if (word_top > 0) word_top--; … … 2818 2823 break; 2819 2824 2820 2825 case 90: 2821 #line 8 59 "/usr/homes/chet/src/bash/src/parse.y"2826 #line 864 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2822 2827 { 2823 2828 (yyval.command) = make_select_command ((yyvsp[(2) - (7)].word), add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), (yyvsp[(6) - (7)].command), word_lineno[word_top]); 2824 2829 if (word_top > 0) word_top--; … … 2826 2831 break; 2827 2832 2828 2833 case 91: 2829 #line 86 4 "/usr/homes/chet/src/bash/src/parse.y"2834 #line 869 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2830 2835 { 2831 2836 (yyval.command) = make_select_command ((yyvsp[(2) - (10)].word), REVERSE_LIST ((yyvsp[(5) - (10)].word_list), WORD_LIST *), (yyvsp[(9) - (10)].command), word_lineno[word_top]); 2832 2837 if (word_top > 0) word_top--; … … 2834 2839 break; 2835 2840 2836 2841 case 92: 2837 #line 8 69 "/usr/homes/chet/src/bash/src/parse.y"2842 #line 874 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2838 2843 { 2839 2844 (yyval.command) = make_select_command ((yyvsp[(2) - (10)].word), REVERSE_LIST ((yyvsp[(5) - (10)].word_list), WORD_LIST *), (yyvsp[(9) - (10)].command), word_lineno[word_top]); 2840 2845 if (word_top > 0) word_top--; … … 2842 2847 break; 2843 2848 2844 2849 case 93: 2845 #line 8 76 "/usr/homes/chet/src/bash/src/parse.y"2850 #line 881 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2846 2851 { 2847 2852 (yyval.command) = make_case_command ((yyvsp[(2) - (6)].word), (PATTERN_LIST *)NULL, word_lineno[word_top]); 2848 2853 if (word_top > 0) word_top--; … … 2850 2855 break; 2851 2856 2852 2857 case 94: 2853 #line 88 1 "/usr/homes/chet/src/bash/src/parse.y"2858 #line 886 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2854 2859 { 2855 2860 (yyval.command) = make_case_command ((yyvsp[(2) - (7)].word), (yyvsp[(5) - (7)].pattern), word_lineno[word_top]); 2856 2861 if (word_top > 0) word_top--; … … 2858 2863 break; 2859 2864 2860 2865 case 95: 2861 #line 8 86 "/usr/homes/chet/src/bash/src/parse.y"2866 #line 891 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2862 2867 { 2863 2868 (yyval.command) = make_case_command ((yyvsp[(2) - (6)].word), (yyvsp[(5) - (6)].pattern), word_lineno[word_top]); 2864 2869 if (word_top > 0) word_top--; … … 2866 2871 break; 2867 2872 2868 2873 case 96: 2869 #line 89 3 "/usr/homes/chet/src/bash/src/parse.y"2874 #line 898 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2870 2875 { (yyval.command) = make_function_def ((yyvsp[(1) - (5)].word), (yyvsp[(5) - (5)].command), function_dstart, function_bstart); } 2871 2876 break; 2872 2877 2873 2878 case 97: 2874 #line 896 "/usr/homes/chet/src/bash/src/parse.y"2879 #line 901 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2875 2880 { (yyval.command) = make_function_def ((yyvsp[(2) - (6)].word), (yyvsp[(6) - (6)].command), function_dstart, function_bstart); } 2876 2881 break; 2877 2882 2878 2883 case 98: 2879 #line 899 "/usr/homes/chet/src/bash/src/parse.y"2884 #line 904 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2880 2885 { (yyval.command) = make_function_def ((yyvsp[(2) - (4)].word), (yyvsp[(4) - (4)].command), function_dstart, function_bstart); } 2881 2886 break; 2882 2887 2883 2888 case 99: 2884 #line 90 3 "/usr/homes/chet/src/bash/src/parse.y"2889 #line 908 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2885 2890 { (yyval.command) = (yyvsp[(1) - (1)].command); } 2886 2891 break; 2887 2892 2888 2893 case 100: 2889 #line 9 05 "/usr/homes/chet/src/bash/src/parse.y"2894 #line 910 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2890 2895 { 2891 2896 COMMAND *tc; 2892 2897 … … 2918 2923 break; 2919 2924 2920 2925 case 101: 2921 #line 9 36 "/usr/homes/chet/src/bash/src/parse.y"2926 #line 941 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2922 2927 { 2923 2928 (yyval.command) = make_subshell_command ((yyvsp[(2) - (3)].command)); 2924 2929 (yyval.command)->flags |= CMD_WANT_SUBSHELL; … … 2926 2931 break; 2927 2932 2928 2933 case 102: 2929 #line 94 3 "/usr/homes/chet/src/bash/src/parse.y"2934 #line 948 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2930 2935 { 2931 2936 (yyval.command) = make_coproc_command ("COPROC", (yyvsp[(2) - (2)].command)); 2932 2937 (yyval.command)->flags |= CMD_WANT_SUBSHELL|CMD_COPROC_SUBSHELL; … … 2934 2939 break; 2935 2940 2936 2941 case 103: 2937 #line 9 48 "/usr/homes/chet/src/bash/src/parse.y"2942 #line 953 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2938 2943 { 2939 2944 COMMAND *tc; 2940 2945 … … 2954 2959 break; 2955 2960 2956 2961 case 104: 2957 #line 9 65 "/usr/homes/chet/src/bash/src/parse.y"2962 #line 970 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2958 2963 { 2959 2964 (yyval.command) = make_coproc_command ((yyvsp[(2) - (3)].word)->word, (yyvsp[(3) - (3)].command)); 2960 2965 (yyval.command)->flags |= CMD_WANT_SUBSHELL|CMD_COPROC_SUBSHELL; … … 2962 2967 break; 2963 2968 2964 2969 case 105: 2965 #line 97 0 "/usr/homes/chet/src/bash/src/parse.y"2970 #line 975 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2966 2971 { 2967 2972 COMMAND *tc; 2968 2973 … … 2982 2987 break; 2983 2988 2984 2989 case 106: 2985 #line 9 87 "/usr/homes/chet/src/bash/src/parse.y"2990 #line 992 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2986 2991 { 2987 2992 (yyval.command) = make_coproc_command ("COPROC", clean_simple_command ((yyvsp[(2) - (2)].command))); 2988 2993 (yyval.command)->flags |= CMD_WANT_SUBSHELL|CMD_COPROC_SUBSHELL; … … 2990 2995 break; 2991 2996 2992 2997 case 107: 2993 #line 99 4 "/usr/homes/chet/src/bash/src/parse.y"2998 #line 999 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2994 2999 { (yyval.command) = make_if_command ((yyvsp[(2) - (5)].command), (yyvsp[(4) - (5)].command), (COMMAND *)NULL); } 2995 3000 break; 2996 3001 2997 3002 case 108: 2998 #line 996 "/usr/homes/chet/src/bash/src/parse.y"3003 #line 1001 "/usr/src/local/bash/bash-4.3-patched/parse.y" 2999 3004 { (yyval.command) = make_if_command ((yyvsp[(2) - (7)].command), (yyvsp[(4) - (7)].command), (yyvsp[(6) - (7)].command)); } 3000 3005 break; 3001 3006 3002 3007 case 109: 3003 #line 998 "/usr/homes/chet/src/bash/src/parse.y"3008 #line 1003 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3004 3009 { (yyval.command) = make_if_command ((yyvsp[(2) - (6)].command), (yyvsp[(4) - (6)].command), (yyvsp[(5) - (6)].command)); } 3005 3010 break; 3006 3011 3007 3012 case 110: 3008 #line 100 3 "/usr/homes/chet/src/bash/src/parse.y"3013 #line 1008 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3009 3014 { (yyval.command) = make_group_command ((yyvsp[(2) - (3)].command)); } 3010 3015 break; 3011 3016 3012 3017 case 111: 3013 #line 10 07 "/usr/homes/chet/src/bash/src/parse.y"3018 #line 1012 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3014 3019 { (yyval.command) = make_arith_command ((yyvsp[(1) - (1)].word_list)); } 3015 3020 break; 3016 3021 3017 3022 case 112: 3018 #line 101 1 "/usr/homes/chet/src/bash/src/parse.y"3023 #line 1016 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3019 3024 { (yyval.command) = (yyvsp[(2) - (3)].command); } 3020 3025 break; 3021 3026 3022 3027 case 113: 3023 #line 10 15 "/usr/homes/chet/src/bash/src/parse.y"3028 #line 1020 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3024 3029 { (yyval.command) = make_if_command ((yyvsp[(2) - (4)].command), (yyvsp[(4) - (4)].command), (COMMAND *)NULL); } 3025 3030 break; 3026 3031 3027 3032 case 114: 3028 #line 10 17 "/usr/homes/chet/src/bash/src/parse.y"3033 #line 1022 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3029 3034 { (yyval.command) = make_if_command ((yyvsp[(2) - (6)].command), (yyvsp[(4) - (6)].command), (yyvsp[(6) - (6)].command)); } 3030 3035 break; 3031 3036 3032 3037 case 115: 3033 #line 10 19 "/usr/homes/chet/src/bash/src/parse.y"3038 #line 1024 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3034 3039 { (yyval.command) = make_if_command ((yyvsp[(2) - (5)].command), (yyvsp[(4) - (5)].command), (yyvsp[(5) - (5)].command)); } 3035 3040 break; 3036 3041 3037 3042 case 117: 3038 #line 102 4 "/usr/homes/chet/src/bash/src/parse.y"3043 #line 1029 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3039 3044 { (yyvsp[(2) - (2)].pattern)->next = (yyvsp[(1) - (2)].pattern); (yyval.pattern) = (yyvsp[(2) - (2)].pattern); } 3040 3045 break; 3041 3046 3042 3047 case 118: 3043 #line 10 28 "/usr/homes/chet/src/bash/src/parse.y"3048 #line 1033 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3044 3049 { (yyval.pattern) = make_pattern_list ((yyvsp[(2) - (4)].word_list), (yyvsp[(4) - (4)].command)); } 3045 3050 break; 3046 3051 3047 3052 case 119: 3048 #line 103 0 "/usr/homes/chet/src/bash/src/parse.y"3053 #line 1035 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3049 3054 { (yyval.pattern) = make_pattern_list ((yyvsp[(2) - (4)].word_list), (COMMAND *)NULL); } 3050 3055 break; 3051 3056 3052 3057 case 120: 3053 #line 103 2 "/usr/homes/chet/src/bash/src/parse.y"3058 #line 1037 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3054 3059 { (yyval.pattern) = make_pattern_list ((yyvsp[(3) - (5)].word_list), (yyvsp[(5) - (5)].command)); } 3055 3060 break; 3056 3061 3057 3062 case 121: 3058 #line 103 4 "/usr/homes/chet/src/bash/src/parse.y"3063 #line 1039 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3059 3064 { (yyval.pattern) = make_pattern_list ((yyvsp[(3) - (5)].word_list), (COMMAND *)NULL); } 3060 3065 break; 3061 3066 3062 3067 case 122: 3063 #line 10 38 "/usr/homes/chet/src/bash/src/parse.y"3068 #line 1043 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3064 3069 { (yyval.pattern) = (yyvsp[(1) - (2)].pattern); } 3065 3070 break; 3066 3071 3067 3072 case 123: 3068 #line 104 0 "/usr/homes/chet/src/bash/src/parse.y"3073 #line 1045 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3069 3074 { (yyvsp[(2) - (3)].pattern)->next = (yyvsp[(1) - (3)].pattern); (yyval.pattern) = (yyvsp[(2) - (3)].pattern); } 3070 3075 break; 3071 3076 3072 3077 case 124: 3073 #line 104 2 "/usr/homes/chet/src/bash/src/parse.y"3078 #line 1047 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3074 3079 { (yyvsp[(1) - (2)].pattern)->flags |= CASEPAT_FALLTHROUGH; (yyval.pattern) = (yyvsp[(1) - (2)].pattern); } 3075 3080 break; 3076 3081 3077 3082 case 125: 3078 #line 104 4 "/usr/homes/chet/src/bash/src/parse.y"3083 #line 1049 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3079 3084 { (yyvsp[(2) - (3)].pattern)->flags |= CASEPAT_FALLTHROUGH; (yyvsp[(2) - (3)].pattern)->next = (yyvsp[(1) - (3)].pattern); (yyval.pattern) = (yyvsp[(2) - (3)].pattern); } 3080 3085 break; 3081 3086 3082 3087 case 126: 3083 #line 10 46 "/usr/homes/chet/src/bash/src/parse.y"3088 #line 1051 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3084 3089 { (yyvsp[(1) - (2)].pattern)->flags |= CASEPAT_TESTNEXT; (yyval.pattern) = (yyvsp[(1) - (2)].pattern); } 3085 3090 break; 3086 3091 3087 3092 case 127: 3088 #line 10 48 "/usr/homes/chet/src/bash/src/parse.y"3093 #line 1053 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3089 3094 { (yyvsp[(2) - (3)].pattern)->flags |= CASEPAT_TESTNEXT; (yyvsp[(2) - (3)].pattern)->next = (yyvsp[(1) - (3)].pattern); (yyval.pattern) = (yyvsp[(2) - (3)].pattern); } 3090 3095 break; 3091 3096 3092 3097 case 128: 3093 #line 105 2 "/usr/homes/chet/src/bash/src/parse.y"3098 #line 1057 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3094 3099 { (yyval.word_list) = make_word_list ((yyvsp[(1) - (1)].word), (WORD_LIST *)NULL); } 3095 3100 break; 3096 3101 3097 3102 case 129: 3098 #line 105 4 "/usr/homes/chet/src/bash/src/parse.y"3103 #line 1059 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3099 3104 { (yyval.word_list) = make_word_list ((yyvsp[(3) - (3)].word), (yyvsp[(1) - (3)].word_list)); } 3100 3105 break; 3101 3106 3102 3107 case 130: 3103 #line 106 3 "/usr/homes/chet/src/bash/src/parse.y"3108 #line 1068 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3104 3109 { 3105 3110 (yyval.command) = (yyvsp[(2) - (2)].command); 3106 3111 if (need_here_doc) … … 3109 3114 break; 3110 3115 3111 3116 case 132: 3112 #line 107 2 "/usr/homes/chet/src/bash/src/parse.y"3117 #line 1077 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3113 3118 { 3114 3119 (yyval.command) = (yyvsp[(2) - (2)].command); 3115 3120 } 3116 3121 break; 3117 3122 3118 3123 case 134: 3119 #line 10 79 "/usr/homes/chet/src/bash/src/parse.y"3124 #line 1084 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3120 3125 { 3121 3126 if ((yyvsp[(1) - (3)].command)->type == cm_connection) 3122 3127 (yyval.command) = connect_async_list ((yyvsp[(1) - (3)].command), (COMMAND *)NULL, '&'); … … 3126 3131 break; 3127 3132 3128 3133 case 136: 3129 #line 109 0 "/usr/homes/chet/src/bash/src/parse.y"3134 #line 1095 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3130 3135 { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), AND_AND); } 3131 3136 break; 3132 3137 3133 3138 case 137: 3134 #line 109 2 "/usr/homes/chet/src/bash/src/parse.y"3139 #line 1097 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3135 3140 { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), OR_OR); } 3136 3141 break; 3137 3142 3138 3143 case 138: 3139 #line 109 4 "/usr/homes/chet/src/bash/src/parse.y"3144 #line 1099 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3140 3145 { 3141 3146 if ((yyvsp[(1) - (4)].command)->type == cm_connection) 3142 3147 (yyval.command) = connect_async_list ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), '&'); … … 3146 3151 break; 3147 3152 3148 3153 case 139: 3149 #line 110 1 "/usr/homes/chet/src/bash/src/parse.y"3154 #line 1106 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3150 3155 { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), ';'); } 3151 3156 break; 3152 3157 3153 3158 case 140: 3154 #line 110 3 "/usr/homes/chet/src/bash/src/parse.y"3159 #line 1108 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3155 3160 { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), ';'); } 3156 3161 break; 3157 3162 3158 3163 case 141: 3159 #line 11 05 "/usr/homes/chet/src/bash/src/parse.y"3164 #line 1110 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3160 3165 { (yyval.command) = (yyvsp[(1) - (1)].command); } 3161 3166 break; 3162 3167 3163 3168 case 144: 3164 #line 111 3 "/usr/homes/chet/src/bash/src/parse.y"3169 #line 1118 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3165 3170 { (yyval.number) = '\n'; } 3166 3171 break; 3167 3172 3168 3173 case 145: 3169 #line 11 15 "/usr/homes/chet/src/bash/src/parse.y"3174 #line 1120 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3170 3175 { (yyval.number) = ';'; } 3171 3176 break; 3172 3177 3173 3178 case 146: 3174 #line 11 17 "/usr/homes/chet/src/bash/src/parse.y"3179 #line 1122 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3175 3180 { (yyval.number) = yacc_EOF; } 3176 3181 break; 3177 3182 3178 3183 case 149: 3179 #line 113 1 "/usr/homes/chet/src/bash/src/parse.y"3184 #line 1136 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3180 3185 { 3181 3186 (yyval.command) = (yyvsp[(1) - (1)].command); 3182 3187 if (need_here_doc) … … 3192 3197 break; 3193 3198 3194 3199 case 150: 3195 #line 114 4 "/usr/homes/chet/src/bash/src/parse.y"3200 #line 1149 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3196 3201 { 3197 3202 if ((yyvsp[(1) - (2)].command)->type == cm_connection) 3198 3203 (yyval.command) = connect_async_list ((yyvsp[(1) - (2)].command), (COMMAND *)NULL, '&'); … … 3211 3216 break; 3212 3217 3213 3218 case 151: 3214 #line 116 0 "/usr/homes/chet/src/bash/src/parse.y"3219 #line 1165 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3215 3220 { 3216 3221 (yyval.command) = (yyvsp[(1) - (2)].command); 3217 3222 if (need_here_doc) … … 3227 3232 break; 3228 3233 3229 3234 case 152: 3230 #line 11 75 "/usr/homes/chet/src/bash/src/parse.y"3235 #line 1180 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3231 3236 { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), AND_AND); } 3232 3237 break; 3233 3238 3234 3239 case 153: 3235 #line 11 77 "/usr/homes/chet/src/bash/src/parse.y"3240 #line 1182 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3236 3241 { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), OR_OR); } 3237 3242 break; 3238 3243 3239 3244 case 154: 3240 #line 11 79 "/usr/homes/chet/src/bash/src/parse.y"3245 #line 1184 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3241 3246 { 3242 3247 if ((yyvsp[(1) - (3)].command)->type == cm_connection) 3243 3248 (yyval.command) = connect_async_list ((yyvsp[(1) - (3)].command), (yyvsp[(3) - (3)].command), '&'); … … 3247 3252 break; 3248 3253 3249 3254 case 155: 3250 #line 11 86 "/usr/homes/chet/src/bash/src/parse.y"3255 #line 1191 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3251 3256 { (yyval.command) = command_connect ((yyvsp[(1) - (3)].command), (yyvsp[(3) - (3)].command), ';'); } 3252 3257 break; 3253 3258 3254 3259 case 156: 3255 #line 11 89 "/usr/homes/chet/src/bash/src/parse.y"3260 #line 1194 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3256 3261 { (yyval.command) = (yyvsp[(1) - (1)].command); } 3257 3262 break; 3258 3263 3259 3264 case 157: 3260 #line 119 3 "/usr/homes/chet/src/bash/src/parse.y"3265 #line 1198 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3261 3266 { (yyval.command) = (yyvsp[(1) - (1)].command); } 3262 3267 break; 3263 3268 3264 3269 case 158: 3265 #line 1 195 "/usr/homes/chet/src/bash/src/parse.y"3270 #line 1200 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3266 3271 { 3267 3272 if ((yyvsp[(2) - (2)].command)) 3268 3273 (yyvsp[(2) - (2)].command)->flags ^= CMD_INVERT_RETURN; /* toggle */ … … 3271 3276 break; 3272 3277 3273 3278 case 159: 3274 #line 120 1 "/usr/homes/chet/src/bash/src/parse.y"3279 #line 1206 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3275 3280 { 3276 3281 if ((yyvsp[(2) - (2)].command)) 3277 3282 (yyvsp[(2) - (2)].command)->flags |= (yyvsp[(1) - (2)].number); … … 3280 3285 break; 3281 3286 3282 3287 case 160: 3283 #line 12 07 "/usr/homes/chet/src/bash/src/parse.y"3288 #line 1212 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3284 3289 { 3285 3290 ELEMENT x; 3286 3291 … … 3300 3305 break; 3301 3306 3302 3307 case 161: 3303 #line 122 4 "/usr/homes/chet/src/bash/src/parse.y"3308 #line 1229 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3304 3309 { 3305 3310 ELEMENT x; 3306 3311 … … 3321 3326 break; 3322 3327 3323 3328 case 162: 3324 #line 124 4 "/usr/homes/chet/src/bash/src/parse.y"3329 #line 1249 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3325 3330 { (yyval.command) = command_connect ((yyvsp[(1) - (4)].command), (yyvsp[(4) - (4)].command), '|'); } 3326 3331 break; 3327 3332 3328 3333 case 163: 3329 #line 12 46 "/usr/homes/chet/src/bash/src/parse.y"3334 #line 1251 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3330 3335 { 3331 3336 /* Make cmd1 |& cmd2 equivalent to cmd1 2>&1 | cmd2 */ 3332 3337 COMMAND *tc; … … 3352 3357 break; 3353 3358 3354 3359 case 164: 3355 #line 12 69 "/usr/homes/chet/src/bash/src/parse.y"3360 #line 1274 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3356 3361 { (yyval.command) = (yyvsp[(1) - (1)].command); } 3357 3362 break; 3358 3363 3359 3364 case 165: 3360 #line 127 3 "/usr/homes/chet/src/bash/src/parse.y"3365 #line 1278 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3361 3366 { (yyval.number) = CMD_TIME_PIPELINE; } 3362 3367 break; 3363 3368 3364 3369 case 166: 3365 #line 12 75 "/usr/homes/chet/src/bash/src/parse.y"3370 #line 1280 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3366 3371 { (yyval.number) = CMD_TIME_PIPELINE|CMD_TIME_POSIX; } 3367 3372 break; 3368 3373 3369 3374 case 167: 3370 #line 12 77 "/usr/homes/chet/src/bash/src/parse.y"3375 #line 1282 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3371 3376 { (yyval.number) = CMD_TIME_PIPELINE|CMD_TIME_POSIX; } 3372 3377 break; 3373 3378 3374 3379 3375 3380 /* Line 1267 of yacc.c. */ 3376 #line 33 77"y.tab.c"3381 #line 3382 "y.tab.c" 3377 3382 default: break; 3378 3383 } 3379 3384 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); … … 3587 3592 } 3588 3593 3589 3594 3590 #line 12 79 "/usr/homes/chet/src/bash/src/parse.y"3595 #line 1284 "/usr/src/local/bash/bash-4.3-patched/parse.y" 3591 3596 3592 3597 3593 3598 /* Initial size to allocate for tokens, and the … … 4736 4741 not already end in an EOF character. */ 4737 4742 if (shell_input_line_terminator != EOF) 4738 4743 { 4739 if (shell_input_line_size < SIZE_MAX && shell_input_line_len > shell_input_line_size - 3)4744 if (shell_input_line_size < SIZE_MAX-3 && (shell_input_line_len+3 > shell_input_line_size)) 4740 4745 shell_input_line = (char *)xrealloc (shell_input_line, 4741 4746 1 + (shell_input_line_size += 2)); 4742 4747 … … 4845 4850 eol_ungetc_lookahead = c; 4846 4851 } 4847 4852 4853 char * 4854 parser_remaining_input () 4855 { 4856 if (shell_input_line == 0) 4857 return 0; 4858 if (shell_input_line_index < 0 || shell_input_line_index >= shell_input_line_len) 4859 return '\0'; /* XXX */ 4860 return (shell_input_line + shell_input_line_index); 4861 } 4862 4848 4863 #ifdef INCLUDE_UNUSED 4849 4864 /* Back the input pointer up by one, effectively `ungetting' a character. */ 4850 4865 static void … … 4948 4963 which allow ESAC to be the next one read. */ 4949 4964 static int esacs_needed_count; 4950 4965 4966 static void 4967 push_heredoc (r) 4968 REDIRECT *r; 4969 { 4970 if (need_here_doc >= HEREDOC_MAX) 4971 { 4972 last_command_exit_value = EX_BADUSAGE; 4973 need_here_doc = 0; 4974 report_syntax_error (_("maximum here-document count exceeded")); 4975 reset_parser (); 4976 exit_shell (last_command_exit_value); 4977 } 4978 redir_stack[need_here_doc++] = r; 4979 } 4980 4951 4981 void 4952 4982 gather_here_documents () 4953 4983 { 4954 4984 int r; 4955 4985 4956 4986 r = 0; 4957 while (need_here_doc )4987 while (need_here_doc > 0) 4958 4988 { 4959 4989 parser_state |= PST_HEREDOC; 4960 4990 make_here_document (redir_stack[r++], line_number); … … 5265 5295 FREE (word_desc_to_read); 5266 5296 word_desc_to_read = (WORD_DESC *)NULL; 5267 5297 5298 eol_ungetc_lookahead = 0; 5299 5268 5300 current_token = '\n'; /* XXX */ 5269 5301 last_read_token = '\n'; 5270 5302 token_to_read = '\n'; … … 5710 5742 within a double-quoted ${...} construct "an even number of 5711 5743 unescaped double-quotes or single-quotes, if any, shall occur." */ 5712 5744 /* This was changed in Austin Group Interp 221 */ 5713 if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'')5745 if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && dolbrace_state != DOLBRACE_QUOTE2 && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'') 5714 5746 continue; 5715 5747 5716 5748 /* Could also check open == '`' if we want to parse grouping constructs … … 6317 6349 reset_parser (); 6318 6350 /* reset_parser clears shell_input_line and associated variables */ 6319 6351 restore_input_line_state (&ls); 6320 if (interactive) 6321 6352 6353 token_to_read = 0; 6322 6354 6323 6355 /* Need to find how many characters parse_and_execute consumed, update 6324 6356 *indp, if flags != 0, copy the portion of the string parsed into RET … … 8387 8419 8388 8420 ps->expand_aliases = expand_aliases; 8389 8421 ps->echo_input_at_read = echo_input_at_read; 8422 ps->need_here_doc = need_here_doc; 8390 8423 8391 8424 ps->token = token; 8392 8425 ps->token_buffer_size = token_buffer_size; … … 8435 8468 8436 8469 expand_aliases = ps->expand_aliases; 8437 8470 echo_input_at_read = ps->echo_input_at_read; 8471 need_here_doc = ps->need_here_doc; 8438 8472 8439 8473 FREE (token); 8440 8474 token = ps->token;
Note:
See TracBrowser
for help on using the repository browser.