| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | /* subst.h -- Names of externally visible functions in subst.c. */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-22 19:11:26 -05:00
										 |  |  | /* Copyright (C) 1993-2010 Free Software Foundation, Inc.
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    This file is part of GNU Bash, the Bourne Again SHell. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  |    Bash is free software: you can redistribute it and/or modify | 
					
						
							|  |  |  |    it under the terms of the GNU General Public License as published by | 
					
						
							|  |  |  |    the Free Software Foundation, either version 3 of the License, or | 
					
						
							|  |  |  |    (at your option) any later version. | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  |    Bash is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |    but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |    GNU General Public License for more details. | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  |    You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |    along with Bash.  If not, see <http://www.gnu.org/licenses/>.
 | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #if !defined (_SUBST_H_)
 | 
					
						
							|  |  |  | #define _SUBST_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "stdc.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-04-06 19:14:31 +00:00
										 |  |  | /* Constants which specify how to handle backslashes and quoting in
 | 
					
						
							|  |  |  |    expand_word_internal ().  Q_DOUBLE_QUOTES means to use the function | 
					
						
							|  |  |  |    slashify_in_quotes () to decide whether the backslash should be | 
					
						
							|  |  |  |    retained.  Q_HERE_DOCUMENT means slashify_in_here_document () to | 
					
						
							|  |  |  |    decide whether to retain the backslash.  Q_KEEP_BACKSLASH means | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  |    to unconditionally retain the backslash.  Q_PATQUOTE means that we're | 
					
						
							|  |  |  |    expanding a pattern ${var%#[#%]pattern} in an expansion surrounded | 
					
						
							| 
									
										
										
										
											2011-11-22 19:11:26 -05:00
										 |  |  |    by double quotes. Q_DOLBRACE means we are expanding a ${...} word, so | 
					
						
							|  |  |  |    backslashes should also escape { and } and be removed. */ | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | #define Q_DOUBLE_QUOTES  0x01
 | 
					
						
							|  |  |  | #define Q_HERE_DOCUMENT  0x02
 | 
					
						
							|  |  |  | #define Q_KEEP_BACKSLASH 0x04
 | 
					
						
							|  |  |  | #define Q_PATQUOTE	 0x08
 | 
					
						
							| 
									
										
										
										
											2001-04-06 19:14:31 +00:00
										 |  |  | #define Q_QUOTED	 0x10
 | 
					
						
							|  |  |  | #define Q_ADDEDQUOTES	 0x20
 | 
					
						
							|  |  |  | #define Q_QUOTEDNULL	 0x40
 | 
					
						
							| 
									
										
										
										
											2011-11-22 19:11:26 -05:00
										 |  |  | #define Q_DOLBRACE	 0x80
 | 
					
						
							| 
									
										
										
										
											2001-04-06 19:14:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | /* Flag values controlling how assignment statements are treated. */ | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | #define ASS_APPEND	0x0001
 | 
					
						
							|  |  |  | #define ASS_MKLOCAL	0x0002
 | 
					
						
							|  |  |  | #define ASS_MKASSOC	0x0004
 | 
					
						
							|  |  |  | #define ASS_MKGLOBAL	0x0008	/* force global assignment */
 | 
					
						
							|  |  |  | #define ASS_NAMEREF	0x0010	/* assigning to nameref variable */
 | 
					
						
							| 
									
										
										
										
											2015-01-15 10:20:04 -05:00
										 |  |  | #define ASS_FROMREF	0x0020	/* assigning from value of nameref variable */
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Flags for the string extraction functions. */ | 
					
						
							| 
									
										
										
										
											2011-11-22 19:11:26 -05:00
										 |  |  | #define SX_NOALLOC	0x0001	/* just skip; don't return substring */
 | 
					
						
							|  |  |  | #define SX_VARNAME	0x0002	/* variable name; for string_extract () */
 | 
					
						
							|  |  |  | #define SX_REQMATCH	0x0004	/* closing/matching delimiter required */
 | 
					
						
							|  |  |  | #define SX_COMMAND	0x0008	/* extracting a shell script/command */
 | 
					
						
							|  |  |  | #define SX_NOCTLESC	0x0010	/* don't honor CTLESC quoting */
 | 
					
						
							|  |  |  | #define SX_NOESCCTLNUL	0x0020	/* don't let CTLESC quote CTLNUL */
 | 
					
						
							|  |  |  | #define SX_NOLONGJMP	0x0040	/* don't longjmp on fatal error */
 | 
					
						
							|  |  |  | #define SX_ARITHSUB	0x0080	/* extracting $(( ... )) (currently unused) */
 | 
					
						
							|  |  |  | #define SX_POSIXEXP	0x0100	/* extracting new Posix pattern removal expansions in extract_dollar_brace_string */
 | 
					
						
							| 
									
										
										
										
											2011-11-22 19:59:44 -05:00
										 |  |  | #define SX_WORD		0x0200	/* extracting word in ${param op word} */
 | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | /* Remove backslashes which are quoting backquotes from STRING.  Modifies
 | 
					
						
							|  |  |  |    STRING, and returns a pointer to it. */ | 
					
						
							|  |  |  | extern char * de_backslash __P((char *)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Replace instances of \! in a string with !. */ | 
					
						
							|  |  |  | extern void unquote_bang __P((char *)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Extract the $( construct in STRING, and return a new string.
 | 
					
						
							|  |  |  |    Start extracting at (SINDEX) as if we had just seen "$(". | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  |    Make (SINDEX) get the position just after the matching ")". | 
					
						
							|  |  |  |    XFLAGS is additional flags to pass to other extraction functions, */ | 
					
						
							|  |  |  | extern char *extract_command_subst __P((char *, int *, int)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Extract the $[ construct in STRING, and return a new string.
 | 
					
						
							|  |  |  |    Start extracting at (SINDEX) as if we had just seen "$[". | 
					
						
							|  |  |  |    Make (SINDEX) get the position just after the matching "]". */ | 
					
						
							|  |  |  | extern char *extract_arithmetic_subst __P((char *, int *)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if defined (PROCESS_SUBSTITUTION)
 | 
					
						
							|  |  |  | /* Extract the <( or >( construct in STRING, and return a new string.
 | 
					
						
							|  |  |  |    Start extracting at (SINDEX) as if we had just seen "<(". | 
					
						
							|  |  |  |    Make (SINDEX) get the position just after the matching ")". */ | 
					
						
							| 
									
										
										
										
											2014-08-18 11:45:12 -04:00
										 |  |  | extern char *extract_process_subst __P((char *, char *, int *, int)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | #endif /* PROCESS_SUBSTITUTION */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Extract the name of the variable to bind to from the assignment string. */ | 
					
						
							|  |  |  | extern char *assignment_name __P((char *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | /* Return a single string of all the words present in LIST, separating
 | 
					
						
							|  |  |  |    each word with SEP. */ | 
					
						
							|  |  |  | extern char *string_list_internal __P((WORD_LIST *, char *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | /* Return a single string of all the words present in LIST, separating
 | 
					
						
							|  |  |  |    each word with a space. */ | 
					
						
							|  |  |  | extern char *string_list __P((WORD_LIST *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | /* Turn $* into a single string, obeying POSIX rules. */ | 
					
						
							|  |  |  | extern char *string_list_dollar_star __P((WORD_LIST *)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Expand $@ into a single string, obeying POSIX rules. */ | 
					
						
							|  |  |  | extern char *string_list_dollar_at __P((WORD_LIST *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | /* Turn the positional paramters into a string, understanding quoting and
 | 
					
						
							|  |  |  |    the various subtleties of using the first character of $IFS as the | 
					
						
							|  |  |  |    separator.  Calls string_list_dollar_at, string_list_dollar_star, and | 
					
						
							|  |  |  |    string_list as appropriate. */ | 
					
						
							|  |  |  | extern char *string_list_pos_params __P((int, WORD_LIST *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | /* Perform quoted null character removal on each element of LIST.
 | 
					
						
							|  |  |  |    This modifies LIST. */ | 
					
						
							|  |  |  | extern void word_list_remove_quoted_nulls __P((WORD_LIST *)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* This performs word splitting and quoted null character removal on
 | 
					
						
							|  |  |  |    STRING. */ | 
					
						
							|  |  |  | extern WORD_LIST *list_string __P((char *, char *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | extern char *ifs_firstchar  __P((int *)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern char *get_word_from_string __P((char **, char *, char **)); | 
					
						
							|  |  |  | extern char *strip_trailing_ifs_whitespace __P((char *, char *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Given STRING, an assignment string, get the value of the right side
 | 
					
						
							|  |  |  |    of the `=', and bind it to the left side.  If EXPAND is true, then | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  |    perform tilde expansion, parameter expansion, command substitution, | 
					
						
							|  |  |  |    and arithmetic expansion on the right-hand side.  Do not perform word | 
					
						
							|  |  |  |    splitting on the result of expansion. */ | 
					
						
							|  |  |  | extern int do_assignment __P((char *)); | 
					
						
							|  |  |  | extern int do_assignment_no_expand __P((char *)); | 
					
						
							| 
									
										
										
										
											2011-11-22 19:11:26 -05:00
										 |  |  | extern int do_word_assignment __P((WORD_DESC *, int)); | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | /* Append SOURCE to TARGET at INDEX.  SIZE is the current amount
 | 
					
						
							|  |  |  |    of space allocated to TARGET.  SOURCE can be NULL, in which | 
					
						
							|  |  |  |    case nothing happens.  Gets rid of SOURCE by free ()ing it. | 
					
						
							|  |  |  |    Returns TARGET in case the location has changed. */ | 
					
						
							|  |  |  | extern char *sub_append_string __P((char *, char *, int *, int *)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Append the textual representation of NUMBER to TARGET.
 | 
					
						
							|  |  |  |    INDEX and SIZE are as in SUB_APPEND_STRING. */ | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern char *sub_append_number __P((intmax_t, char *, int *, int *)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Return the word list that corresponds to `$*'. */ | 
					
						
							|  |  |  | extern WORD_LIST *list_rest_of_args __P((void)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Make a single large string out of the dollar digit variables,
 | 
					
						
							|  |  |  |    and the rest_of_args.  If DOLLAR_STAR is 1, then obey the special | 
					
						
							|  |  |  |    case of "$*" with respect to IFS. */ | 
					
						
							|  |  |  | extern char *string_rest_of_args __P((int)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | extern int number_of_args __P((void)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | /* Expand STRING by performing parameter expansion, command substitution,
 | 
					
						
							|  |  |  |    and arithmetic expansion.  Dequote the resulting WORD_LIST before | 
					
						
							|  |  |  |    returning it, but do not perform word splitting.  The call to | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  |    remove_quoted_nulls () is made here because word splitting normally | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  |    takes care of quote removal. */ | 
					
						
							|  |  |  | extern WORD_LIST *expand_string_unsplit __P((char *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | /* Expand the rhs of an assignment statement. */ | 
					
						
							|  |  |  | extern WORD_LIST *expand_string_assignment __P((char *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | /* Expand a prompt string. */ | 
					
						
							| 
									
										
										
										
											2008-11-18 13:15:12 +00:00
										 |  |  | extern WORD_LIST *expand_prompt_string __P((char *, int, int)); | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | /* Expand STRING just as if you were expanding a word.  This also returns
 | 
					
						
							|  |  |  |    a list of words.  Note that filename globbing is *NOT* done for word | 
					
						
							|  |  |  |    or string expansion, just when the shell is expanding a command.  This | 
					
						
							|  |  |  |    does parameter expansion, command substitution, arithmetic expansion, | 
					
						
							|  |  |  |    and word splitting.  Dequote the resultant WORD_LIST before returning. */ | 
					
						
							|  |  |  | extern WORD_LIST *expand_string __P((char *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | /* Convenience functions that expand strings to strings, taking care of
 | 
					
						
							|  |  |  |    converting the WORD_LIST * returned by the expand_string* functions | 
					
						
							|  |  |  |    to a string and deallocating the WORD_LIST *. */ | 
					
						
							|  |  |  | extern char *expand_string_to_string __P((char *, int)); | 
					
						
							|  |  |  | extern char *expand_string_unsplit_to_string __P((char *, int)); | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | extern char *expand_assignment_string_to_string __P((char *, int)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-10-10 14:15:34 +00:00
										 |  |  | /* Expand an arithmetic expression string */ | 
					
						
							|  |  |  | extern char *expand_arith_string __P((char *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* De-quote quoted characters in STRING. */ | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern char *dequote_string __P((char *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | /* De-quote CTLESC-escaped CTLESC or CTLNUL characters in STRING. */ | 
					
						
							|  |  |  | extern char *dequote_escapes __P((char *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-10-10 14:15:34 +00:00
										 |  |  | /* De-quote quoted characters in each word in LIST. */ | 
					
						
							|  |  |  | extern WORD_LIST *dequote_list __P((WORD_LIST *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | /* Expand WORD, performing word splitting on the result.  This does
 | 
					
						
							|  |  |  |    parameter expansion, command substitution, arithmetic expansion, | 
					
						
							|  |  |  |    word splitting, and quote removal. */ | 
					
						
							|  |  |  | extern WORD_LIST *expand_word __P((WORD_DESC *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Expand WORD, but do not perform word splitting on the result.  This
 | 
					
						
							|  |  |  |    does parameter expansion, command substitution, arithmetic expansion, | 
					
						
							|  |  |  |    and quote removal. */ | 
					
						
							| 
									
										
										
										
											2001-04-06 19:14:31 +00:00
										 |  |  | extern WORD_LIST *expand_word_unsplit __P((WORD_DESC *, int)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern WORD_LIST *expand_word_leave_quoted __P((WORD_DESC *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Return the value of a positional parameter.  This handles values > 10. */ | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern char *get_dollar_var_value __P((intmax_t)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | /* Quote a string to protect it from word splitting. */ | 
					
						
							|  |  |  | extern char *quote_string __P((char *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | /* Quote escape characters (characters special to interals of expansion)
 | 
					
						
							|  |  |  |    in a string. */ | 
					
						
							|  |  |  | extern char *quote_escapes __P((char *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | /* And remove such quoted special characters. */ | 
					
						
							|  |  |  | extern char *remove_quoted_escapes __P((char *)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Remove CTLNUL characters from STRING unless they are quoted with CTLESC. */ | 
					
						
							|  |  |  | extern char *remove_quoted_nulls __P((char *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | /* Perform quote removal on STRING.  If QUOTED > 0, assume we are obeying the
 | 
					
						
							|  |  |  |    backslash quoting rules for within double quotes. */ | 
					
						
							|  |  |  | extern char *string_quote_removal __P((char *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Perform quote removal on word WORD.  This allocates and returns a new
 | 
					
						
							|  |  |  |    WORD_DESC *. */ | 
					
						
							|  |  |  | extern WORD_DESC *word_quote_removal __P((WORD_DESC *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Perform quote removal on all words in LIST.  If QUOTED is non-zero,
 | 
					
						
							|  |  |  |    the members of the list are treated as if they are surrounded by | 
					
						
							|  |  |  |    double quotes.  Return a new list, or NULL if LIST is NULL. */ | 
					
						
							|  |  |  | extern WORD_LIST *word_list_quote_removal __P((WORD_LIST *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | /* Called when IFS is changed to maintain some private variables. */ | 
					
						
							|  |  |  | extern void setifs __P((SHELL_VAR *)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Return the value of $IFS, or " \t\n" if IFS is unset. */ | 
					
						
							|  |  |  | extern char *getifs __P((void)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | /* This splits a single word into a WORD LIST on $IFS, but only if the word
 | 
					
						
							|  |  |  |    is not quoted.  list_string () performs quote removal for us, even if we | 
					
						
							|  |  |  |    don't do any splitting. */ | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern WORD_LIST *word_split __P((WORD_DESC *, char *)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Take the list of words in LIST and do the various substitutions.  Return
 | 
					
						
							|  |  |  |    a new list of words which is the expanded list, and without things like | 
					
						
							|  |  |  |    variable assignments. */ | 
					
						
							|  |  |  | extern WORD_LIST *expand_words __P((WORD_LIST *)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Same as expand_words (), but doesn't hack variable or environment
 | 
					
						
							|  |  |  |    variables. */ | 
					
						
							|  |  |  | extern WORD_LIST *expand_words_no_vars __P((WORD_LIST *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | /* Perform the `normal shell expansions' on a WORD_LIST.  These are
 | 
					
						
							|  |  |  |    brace expansion, tilde expansion, parameter and variable substitution, | 
					
						
							|  |  |  |    command substitution, arithmetic expansion, and word splitting. */ | 
					
						
							|  |  |  | extern WORD_LIST *expand_words_shellexp __P((WORD_LIST *)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | extern WORD_DESC *command_substitute __P((char *, int)); | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | extern char *pat_subst __P((char *, char *, char *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-18 13:15:12 +00:00
										 |  |  | extern int fifos_pending __P((void)); | 
					
						
							| 
									
										
										
										
											2011-11-22 19:11:26 -05:00
										 |  |  | extern int num_fifos __P((void)); | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | extern void unlink_fifo_list __P((void)); | 
					
						
							| 
									
										
										
										
											2011-11-22 19:11:26 -05:00
										 |  |  | extern void unlink_fifo __P((int)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern char *copy_fifo_list __P((int *)); | 
					
						
							|  |  |  | extern void unlink_new_fifos __P((char *, int)); | 
					
						
							|  |  |  | extern void close_new_fifos __P((char *, int)); | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | extern WORD_LIST *list_string_with_quotes __P((char *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | #if defined (ARRAY_VARS)
 | 
					
						
							|  |  |  | extern char *extract_array_assignment_list __P((char *, int *)); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | #if defined (COND_COMMAND)
 | 
					
						
							|  |  |  | extern char *remove_backslashes __P((char *)); | 
					
						
							|  |  |  | extern char *cond_expand_word __P((WORD_DESC *, int)); | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | /* Flags for skip_to_delim */ | 
					
						
							|  |  |  | #define SD_NOJMP	0x01	/* don't longjmp on fatal error. */
 | 
					
						
							|  |  |  | #define SD_INVERT	0x02	/* look for chars NOT in passed set */
 | 
					
						
							| 
									
										
										
										
											2011-11-21 20:51:19 -05:00
										 |  |  | #define SD_NOQUOTEDELIM	0x04	/* don't let single or double quotes act as delimiters */
 | 
					
						
							|  |  |  | #define SD_NOSKIPCMD	0x08	/* don't skip over $(, <(, or >( command/process substitution */
 | 
					
						
							| 
									
										
										
										
											2011-11-22 19:11:26 -05:00
										 |  |  | #define SD_EXTGLOB	0x10	/* skip over extended globbing patterns if appropriate */
 | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | #define SD_IGNOREQUOTE	0x20	/* single and double quotes are not special */
 | 
					
						
							|  |  |  | #define SD_GLOB		0x40	/* skip over glob patterns like bracket expressions */
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | extern int skip_to_delim __P((char *, int, char *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | #if defined (READLINE)
 | 
					
						
							|  |  |  | extern int char_is_quoted __P((char *, int)); | 
					
						
							|  |  |  | extern int unclosed_pair __P((char *, int, char *)); | 
					
						
							| 
									
										
										
										
											2011-11-21 20:51:19 -05:00
										 |  |  | extern WORD_LIST *split_at_delims __P((char *, int, char *, int, int, int *, int *)); | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | /* Variables used to keep track of the characters in IFS. */ | 
					
						
							|  |  |  | extern SHELL_VAR *ifs_var; | 
					
						
							|  |  |  | extern char *ifs_value; | 
					
						
							|  |  |  | extern unsigned char ifs_cmap[]; | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #if defined (HANDLE_MULTIBYTE)
 | 
					
						
							|  |  |  | extern unsigned char ifs_firstc[]; | 
					
						
							|  |  |  | extern size_t ifs_firstc_len; | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern unsigned char ifs_firstc; | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Evaluates to 1 if C is a character in $IFS. */ | 
					
						
							|  |  |  | #define isifs(c)	(ifs_cmap[(unsigned char)(c)] != 0)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | /* How to determine the quoted state of the character C. */ | 
					
						
							|  |  |  | #define QUOTED_CHAR(c)  ((c) == CTLESC)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Is the first character of STRING a quoted NULL character? */ | 
					
						
							|  |  |  | #define QUOTED_NULL(string) ((string)[0] == CTLNUL && (string)[1] == '\0')
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | #endif /* !_SUBST_H_ */
 |