| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | /* variables.h -- data structures for shell variables. */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | /* Copyright (C) 1987-2012 Free Software Foundation, Inc.
 | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +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. | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +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. | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    You should have received a copy of the GNU General Public License | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  |    along with Bash.  If not, see <http://www.gnu.org/licenses/>.
 | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | #if !defined (_VARIABLES_H_)
 | 
					
						
							|  |  |  | #define _VARIABLES_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "stdc.h"
 | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | #include "array.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | #include "assoc.h"
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Shell variables and functions are stored in hash tables. */ | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | #include "hashlib.h"
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | #include "conftypes.h"
 | 
					
						
							| 
									
										
										
										
											1999-02-19 17:11:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | /* A variable context. */ | 
					
						
							|  |  |  | typedef struct var_context { | 
					
						
							|  |  |  |   char *name;		/* empty or NULL means global context */ | 
					
						
							|  |  |  |   int scope;		/* 0 means global context */ | 
					
						
							|  |  |  |   int flags; | 
					
						
							|  |  |  |   struct var_context *up;	/* previous function calls */ | 
					
						
							|  |  |  |   struct var_context *down;	/* down towards global context */ | 
					
						
							|  |  |  |   HASH_TABLE *table;		/* variables at this scope */ | 
					
						
							|  |  |  | } VAR_CONTEXT; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Flags for var_context->flags */ | 
					
						
							|  |  |  | #define VC_HASLOCAL	0x01
 | 
					
						
							|  |  |  | #define VC_HASTMPVAR	0x02
 | 
					
						
							|  |  |  | #define VC_FUNCENV	0x04	/* also function if name != NULL */
 | 
					
						
							|  |  |  | #define VC_BLTNENV	0x08	/* builtin_env */
 | 
					
						
							|  |  |  | #define VC_TEMPENV	0x10	/* temporary_env */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define VC_TEMPFLAGS	(VC_FUNCENV|VC_BLTNENV|VC_TEMPENV)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Accessing macros */ | 
					
						
							|  |  |  | #define vc_isfuncenv(vc)	(((vc)->flags & VC_FUNCENV) != 0)
 | 
					
						
							|  |  |  | #define vc_isbltnenv(vc)	(((vc)->flags & VC_BLTNENV) != 0)
 | 
					
						
							|  |  |  | #define vc_istempenv(vc)	(((vc)->flags & (VC_TEMPFLAGS)) == VC_TEMPENV)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define vc_istempscope(vc)	(((vc)->flags & (VC_TEMPENV|VC_BLTNENV)) != 0)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define vc_haslocals(vc)	(((vc)->flags & VC_HASLOCAL) != 0)
 | 
					
						
							|  |  |  | #define vc_hastmpvars(vc)	(((vc)->flags & VC_HASTMPVAR) != 0)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | /* What a shell variable looks like. */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | typedef struct variable *sh_var_value_func_t __P((struct variable *)); | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | typedef struct variable *sh_var_assign_func_t __P((struct variable *, char *, arrayind_t, char *)); | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* For the future */ | 
					
						
							|  |  |  | union _value { | 
					
						
							|  |  |  |   char *s;			/* string value */ | 
					
						
							|  |  |  |   intmax_t i;			/* int value */ | 
					
						
							|  |  |  |   COMMAND *f;			/* function */ | 
					
						
							|  |  |  |   ARRAY *a;			/* array */ | 
					
						
							|  |  |  |   HASH_TABLE *h;		/* associative array */ | 
					
						
							|  |  |  |   double d;			/* floating point number */ | 
					
						
							| 
									
										
										
										
											2004-07-27 13:29:18 +00:00
										 |  |  | #if defined (HAVE_LONG_DOUBLE)
 | 
					
						
							|  |  |  |   long double ld;		/* long double */ | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  |   struct variable *v;		/* possible indirect variable use */ | 
					
						
							|  |  |  |   void *opaque;			/* opaque data for future use */ | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | typedef struct variable { | 
					
						
							|  |  |  |   char *name;			/* Symbol that the user types. */ | 
					
						
							|  |  |  |   char *value;			/* Value that is returned. */ | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  |   char *exportstr;		/* String for the environment. */ | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  |   sh_var_value_func_t *dynamic_value;	/* Function called to return a `dynamic'
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 				   value for a variable, like $SECONDS | 
					
						
							|  |  |  | 				   or $RANDOM. */ | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  |   sh_var_assign_func_t *assign_func; /* Function called when this `special
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 				   variable' is assigned a value in | 
					
						
							|  |  |  | 				   bind_variable. */ | 
					
						
							|  |  |  |   int attributes;		/* export, readonly, array, invisible... */ | 
					
						
							|  |  |  |   int context;			/* Which context this variable belongs to. */ | 
					
						
							|  |  |  | } SHELL_VAR; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | typedef struct _vlist { | 
					
						
							|  |  |  |   SHELL_VAR **list; | 
					
						
							|  |  |  |   int list_size;	/* allocated size */ | 
					
						
							|  |  |  |   int list_len;		/* current number of entries */ | 
					
						
							|  |  |  | } VARLIST; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | /* The various attributes that a given variable can have. */ | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | /* First, the user-visible attributes */ | 
					
						
							|  |  |  | #define att_exported	0x0000001	/* export to environment */
 | 
					
						
							|  |  |  | #define att_readonly	0x0000002	/* cannot change */
 | 
					
						
							|  |  |  | #define att_array	0x0000004	/* value is an array */
 | 
					
						
							|  |  |  | #define att_function	0x0000008	/* value is a function */
 | 
					
						
							|  |  |  | #define att_integer	0x0000010	/* internal representation is int */
 | 
					
						
							|  |  |  | #define att_local	0x0000020	/* variable is local to a function */
 | 
					
						
							|  |  |  | #define att_assoc	0x0000040	/* variable is an associative array */
 | 
					
						
							|  |  |  | #define att_trace	0x0000080	/* function is traced with DEBUG trap */
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | #define att_uppercase	0x0000100	/* word converted to uppercase on assignment */
 | 
					
						
							|  |  |  | #define att_lowercase	0x0000200	/* word converted to lowercase on assignment */
 | 
					
						
							|  |  |  | #define att_capcase	0x0000400	/* word capitalized on assignment */
 | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | #define att_nameref	0x0000800	/* word is a name reference */
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | #define user_attrs	(att_exported|att_readonly|att_integer|att_local|att_trace|att_uppercase|att_lowercase|att_capcase|att_nameref)
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define attmask_user	0x0000fff
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Internal attributes used for bookkeeping */ | 
					
						
							|  |  |  | #define att_invisible	0x0001000	/* cannot see */
 | 
					
						
							|  |  |  | #define att_nounset	0x0002000	/* cannot unset */
 | 
					
						
							|  |  |  | #define att_noassign	0x0004000	/* assignment not allowed */
 | 
					
						
							|  |  |  | #define att_imported	0x0008000	/* came from environment */
 | 
					
						
							|  |  |  | #define att_special	0x0010000	/* requires special handling */
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | #define att_nofree	0x0020000	/* do not free value on unset */
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define	attmask_int	0x00ff000
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Internal attributes used for variable scoping. */ | 
					
						
							|  |  |  | #define att_tempvar	0x0100000	/* variable came from the temp environment */
 | 
					
						
							|  |  |  | #define att_propagate	0x0200000	/* propagate to previous scope */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define attmask_scope	0x0f00000
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define exported_p(var)		((((var)->attributes) & (att_exported)))
 | 
					
						
							|  |  |  | #define readonly_p(var)		((((var)->attributes) & (att_readonly)))
 | 
					
						
							|  |  |  | #define array_p(var)		((((var)->attributes) & (att_array)))
 | 
					
						
							|  |  |  | #define function_p(var)		((((var)->attributes) & (att_function)))
 | 
					
						
							|  |  |  | #define integer_p(var)		((((var)->attributes) & (att_integer)))
 | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | #define local_p(var)		((((var)->attributes) & (att_local)))
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | #define assoc_p(var)		((((var)->attributes) & (att_assoc)))
 | 
					
						
							|  |  |  | #define trace_p(var)		((((var)->attributes) & (att_trace)))
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | #define uppercase_p(var)	((((var)->attributes) & (att_uppercase)))
 | 
					
						
							|  |  |  | #define lowercase_p(var)	((((var)->attributes) & (att_lowercase)))
 | 
					
						
							|  |  |  | #define capcase_p(var)		((((var)->attributes) & (att_capcase)))
 | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | #define nameref_p(var)		((((var)->attributes) & (att_nameref)))
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define invisible_p(var)	((((var)->attributes) & (att_invisible)))
 | 
					
						
							|  |  |  | #define non_unsettable_p(var)	((((var)->attributes) & (att_nounset)))
 | 
					
						
							| 
									
										
										
										
											2001-04-06 19:14:31 +00:00
										 |  |  | #define noassign_p(var)		((((var)->attributes) & (att_noassign)))
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | #define imported_p(var)		((((var)->attributes) & (att_imported)))
 | 
					
						
							|  |  |  | #define specialvar_p(var)	((((var)->attributes) & (att_special)))
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | #define nofree_p(var)		((((var)->attributes) & (att_nofree)))
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define tempvar_p(var)		((((var)->attributes) & (att_tempvar)))
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Acessing variable values: rvalues */ | 
					
						
							|  |  |  | #define value_cell(var)		((var)->value)
 | 
					
						
							|  |  |  | #define function_cell(var)	(COMMAND *)((var)->value)
 | 
					
						
							|  |  |  | #define array_cell(var)		(ARRAY *)((var)->value)
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | #define assoc_cell(var)		(HASH_TABLE *)((var)->value)
 | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | #define nameref_cell(var)	((var)->value)		/* so it can change later */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define NAMEREF_MAX	8	/* only 8 levels of nameref indirection */
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define var_isnull(var)		((var)->value == 0)
 | 
					
						
							|  |  |  | #define var_isset(var)		((var)->value != 0)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Assigning variable values: lvalues */ | 
					
						
							|  |  |  | #define var_setvalue(var, str)	((var)->value = (str))
 | 
					
						
							|  |  |  | #define var_setfunc(var, func)	((var)->value = (char *)(func))
 | 
					
						
							|  |  |  | #define var_setarray(var, arr)	((var)->value = (char *)(arr))
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | #define var_setassoc(var, arr)	((var)->value = (char *)(arr))
 | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | #define var_setref(var, str)	((var)->value = (str))
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | /* Make VAR be auto-exported. */ | 
					
						
							|  |  |  | #define set_auto_export(var) \
 | 
					
						
							|  |  |  |   do { (var)->attributes |= att_exported; array_needs_making = 1; } while (0) | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define SETVARATTR(var, attr, undo) \
 | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | 	((undo == 0) ? ((var)->attributes |= (attr)) \ | 
					
						
							|  |  |  | 		     : ((var)->attributes &= ~(attr))) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define VSETATTR(var, attr)	((var)->attributes |= (attr))
 | 
					
						
							|  |  |  | #define VUNSETATTR(var, attr)	((var)->attributes &= ~(attr))
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | #define VGETFLAGS(var)		((var)->attributes)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define VSETFLAGS(var, flags)	((var)->attributes = (flags))
 | 
					
						
							|  |  |  | #define VCLRFLAGS(var)		((var)->attributes = 0)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | /* Macros to perform various operations on `exportstr' member of a SHELL_VAR. */ | 
					
						
							|  |  |  | #define CLEAR_EXPORTSTR(var)	(var)->exportstr = (char *)NULL
 | 
					
						
							|  |  |  | #define COPY_EXPORTSTR(var)	((var)->exportstr) ? savestring ((var)->exportstr) : (char *)NULL
 | 
					
						
							|  |  |  | #define SET_EXPORTSTR(var, value)  (var)->exportstr = (value)
 | 
					
						
							|  |  |  | #define SAVE_EXPORTSTR(var, value) (var)->exportstr = (value) ? savestring (value) : (char *)NULL
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define FREE_EXPORTSTR(var) \
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 	do { if ((var)->exportstr) free ((var)->exportstr); } while (0) | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define CACHE_IMPORTSTR(var, value) \
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 	(var)->exportstr = savestring (value) | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define INVALIDATE_EXPORTSTR(var) \
 | 
					
						
							|  |  |  | 	do { \ | 
					
						
							|  |  |  | 	  if ((var)->exportstr) \ | 
					
						
							|  |  |  | 	    { \ | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 	      free ((var)->exportstr); \ | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | 	      (var)->exportstr = (char *)NULL; \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	} while (0) | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | /* Stuff for hacking variables. */ | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | typedef int sh_var_map_func_t __P((SHELL_VAR *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | /* Where we keep the variables and functions */ | 
					
						
							|  |  |  | extern VAR_CONTEXT *global_variables; | 
					
						
							|  |  |  | extern VAR_CONTEXT *shell_variables; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern HASH_TABLE *shell_functions; | 
					
						
							|  |  |  | extern HASH_TABLE *temporary_env; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern int variable_context; | 
					
						
							|  |  |  | extern char *dollar_vars[]; | 
					
						
							|  |  |  | extern char **export_env; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | extern void initialize_shell_variables __P((char **, int)); | 
					
						
							|  |  |  | extern SHELL_VAR *set_if_not __P((char *, char *)); | 
					
						
							| 
									
										
										
										
											2001-04-06 19:14:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern void sh_set_lines_and_columns __P((int, int)); | 
					
						
							| 
									
										
										
										
											2001-04-06 19:14:31 +00:00
										 |  |  | extern void set_pwd __P((void)); | 
					
						
							| 
									
										
										
										
											1999-02-19 17:11:39 +00:00
										 |  |  | extern void set_ppid __P((void)); | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | extern void make_funcname_visible __P((int)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern SHELL_VAR *var_lookup __P((const char *, VAR_CONTEXT *)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | extern SHELL_VAR *find_function __P((const char *)); | 
					
						
							| 
									
										
										
										
											2004-07-27 13:29:18 +00:00
										 |  |  | extern FUNCTION_DEF *find_function_def __P((const char *)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern SHELL_VAR *find_variable __P((const char *)); | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | extern SHELL_VAR *find_variable_noref __P((const char *)); | 
					
						
							|  |  |  | extern SHELL_VAR *find_variable_last_nameref __P((const char *)); | 
					
						
							|  |  |  | extern SHELL_VAR *find_global_variable_last_nameref __P((const char *)); | 
					
						
							|  |  |  | extern SHELL_VAR *find_variable_nameref __P((SHELL_VAR *)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern SHELL_VAR *find_variable_internal __P((const char *, int)); | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | extern SHELL_VAR *find_variable_tempenv __P((const char *)); | 
					
						
							|  |  |  | extern SHELL_VAR *find_variable_notempenv __P((const char *)); | 
					
						
							| 
									
										
										
										
											2011-11-22 19:11:26 -05:00
										 |  |  | extern SHELL_VAR *find_global_variable __P((const char *)); | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | extern SHELL_VAR *find_global_variable_noref __P((const char *)); | 
					
						
							|  |  |  | extern SHELL_VAR *find_shell_variable __P((const char *)); | 
					
						
							|  |  |  | extern SHELL_VAR *find_tempenv_variable __P((const char *)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern SHELL_VAR *copy_variable __P((SHELL_VAR *)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern SHELL_VAR *make_local_variable __P((const char *)); | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | extern SHELL_VAR *bind_variable __P((const char *, char *, int)); | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | extern SHELL_VAR *bind_global_variable __P((const char *, char *, int)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern SHELL_VAR *bind_function __P((const char *, COMMAND *)); | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-27 13:29:18 +00:00
										 |  |  | extern void bind_function_def __P((const char *, FUNCTION_DEF *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern SHELL_VAR **map_over __P((sh_var_map_func_t *, VAR_CONTEXT *)); | 
					
						
							|  |  |  | SHELL_VAR **map_over_funcs __P((sh_var_map_func_t *)); | 
					
						
							|  |  |  |       | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern SHELL_VAR **all_shell_variables __P((void)); | 
					
						
							|  |  |  | extern SHELL_VAR **all_shell_functions __P((void)); | 
					
						
							|  |  |  | extern SHELL_VAR **all_visible_variables __P((void)); | 
					
						
							|  |  |  | extern SHELL_VAR **all_visible_functions __P((void)); | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | extern SHELL_VAR **all_exported_variables __P((void)); | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern SHELL_VAR **local_exported_variables __P((void)); | 
					
						
							|  |  |  | extern SHELL_VAR **all_local_variables __P((void)); | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | #if defined (ARRAY_VARS)
 | 
					
						
							|  |  |  | extern SHELL_VAR **all_array_variables __P((void)); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern char **all_variables_matching_prefix __P((const char *)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | extern char **make_var_array __P((HASH_TABLE *)); | 
					
						
							| 
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 |  |  | extern char **add_or_supercede_exported_var __P((char *, int)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern char *get_variable_value __P((SHELL_VAR *)); | 
					
						
							| 
									
										
										
										
											2001-04-06 19:14:31 +00:00
										 |  |  | extern char *get_string_value __P((const char *)); | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern char *sh_get_env_value __P((const char *)); | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | extern char *make_variable_value __P((SHELL_VAR *, char *, int)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | extern SHELL_VAR *bind_variable_value __P((SHELL_VAR *, char *, int)); | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | extern SHELL_VAR *bind_int_variable __P((char *, char *)); | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern SHELL_VAR *bind_var_to_int __P((char *, intmax_t)); | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-22 19:11:26 -05:00
										 |  |  | extern int assign_in_env __P((WORD_DESC *, int)); | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern int unbind_variable __P((const char *)); | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | extern int unbind_nameref __P((const char *)); | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern int unbind_func __P((const char *)); | 
					
						
							| 
									
										
										
										
											2004-07-27 13:29:18 +00:00
										 |  |  | extern int unbind_function_def __P((const char *)); | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | extern int delete_var __P((const char *, VAR_CONTEXT *)); | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern int makunbound __P((const char *, VAR_CONTEXT *)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern int kill_local_variable __P((const char *)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern void delete_all_variables __P((HASH_TABLE *)); | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern void delete_all_contexts __P((VAR_CONTEXT *)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern VAR_CONTEXT *new_var_context __P((char *, int)); | 
					
						
							|  |  |  | extern void dispose_var_context __P((VAR_CONTEXT *)); | 
					
						
							|  |  |  | extern VAR_CONTEXT *push_var_context __P((char *, int, HASH_TABLE *)); | 
					
						
							|  |  |  | extern void pop_var_context __P((void)); | 
					
						
							|  |  |  | extern VAR_CONTEXT *push_scope __P((int, HASH_TABLE *)); | 
					
						
							|  |  |  | extern void pop_scope __P((int)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern void push_context __P((char *, int, HASH_TABLE *)); | 
					
						
							|  |  |  | extern void pop_context __P((void)); | 
					
						
							|  |  |  | extern void push_dollar_vars __P((void)); | 
					
						
							|  |  |  | extern void pop_dollar_vars __P((void)); | 
					
						
							|  |  |  | extern void dispose_saved_dollar_vars __P((void)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-27 13:29:18 +00:00
										 |  |  | extern void push_args __P((WORD_LIST *)); | 
					
						
							|  |  |  | extern void pop_args __P((void)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern void adjust_shell_level __P((int)); | 
					
						
							|  |  |  | extern void non_unsettable __P((char *)); | 
					
						
							|  |  |  | extern void dispose_variable __P((SHELL_VAR *)); | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | extern void dispose_used_env_vars __P((void)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern void dispose_function_env __P((void)); | 
					
						
							|  |  |  | extern void dispose_builtin_env __P((void)); | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | extern void merge_temporary_env __P((void)); | 
					
						
							|  |  |  | extern void merge_builtin_env __P((void)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern void kill_all_local_variables __P((void)); | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern void set_var_read_only __P((char *)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern void set_func_read_only __P((const char *)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern void set_var_auto_export __P((char *)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern void set_func_auto_export __P((const char *)); | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern void sort_variables __P((SHELL_VAR **)); | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-22 20:00:19 -05:00
										 |  |  | extern int chkexport __P((char *)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern void maybe_make_export_env __P((void)); | 
					
						
							| 
									
										
										
										
											1999-02-19 17:11:39 +00:00
										 |  |  | extern void update_export_env_inplace __P((char *, int, char *)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern void put_command_name_into_env __P((char *)); | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern void put_gnu_argv_flags_into_env __P((intmax_t, char *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern void print_var_list __P((SHELL_VAR **)); | 
					
						
							| 
									
										
										
										
											2001-04-06 19:14:31 +00:00
										 |  |  | extern void print_func_list __P((SHELL_VAR **)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern void print_assignment __P((SHELL_VAR *)); | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | extern void print_var_value __P((SHELL_VAR *, int)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | extern void print_var_function __P((SHELL_VAR *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | #if defined (ARRAY_VARS)
 | 
					
						
							|  |  |  | extern SHELL_VAR *make_new_array_variable __P((char *)); | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | extern SHELL_VAR *make_local_array_variable __P((char *, int)); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | extern SHELL_VAR *make_new_assoc_variable __P((char *)); | 
					
						
							|  |  |  | extern SHELL_VAR *make_local_assoc_variable __P((char *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern void set_pipestatus_array __P((int *, int)); | 
					
						
							| 
									
										
										
										
											2011-11-22 19:11:26 -05:00
										 |  |  | extern ARRAY *save_pipestatus_array __P((void)); | 
					
						
							|  |  |  | extern void restore_pipestatus_array __P((ARRAY *)); | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern void set_pipestatus_from_exit __P((int)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* The variable in NAME has just had its state changed.  Check to see if it
 | 
					
						
							|  |  |  |    is one of the special ones where something special happens. */ | 
					
						
							|  |  |  | extern void stupidly_hack_special_variables __P((char *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | /* Reinitialize some special variables that have external effects upon unset
 | 
					
						
							|  |  |  |    when the shell reinitializes itself. */ | 
					
						
							|  |  |  | extern void reinit_special_variables __P((void)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-04-06 19:14:31 +00:00
										 |  |  | extern int get_random_number __P((void)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | /* The `special variable' functions that get called when a particular
 | 
					
						
							|  |  |  |    variable is set. */ | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern void sv_ifs __P((char *)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern void sv_path __P((char *)); | 
					
						
							|  |  |  | extern void sv_mail __P((char *)); | 
					
						
							| 
									
										
										
										
											2011-11-22 19:11:26 -05:00
										 |  |  | extern void sv_funcnest __P((char *)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern void sv_globignore __P((char *)); | 
					
						
							|  |  |  | extern void sv_ignoreeof __P((char *)); | 
					
						
							|  |  |  | extern void sv_strict_posix __P((char *)); | 
					
						
							|  |  |  | extern void sv_optind __P((char *)); | 
					
						
							|  |  |  | extern void sv_opterr __P((char *)); | 
					
						
							|  |  |  | extern void sv_locale __P((char *)); | 
					
						
							| 
									
										
										
										
											2011-11-21 20:51:19 -05:00
										 |  |  | extern void sv_xtracefd __P((char *)); | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | extern void sv_shcompat __P((char *)); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #if defined (READLINE)
 | 
					
						
							| 
									
										
										
										
											2004-07-27 13:29:18 +00:00
										 |  |  | extern void sv_comp_wordbreaks __P((char *)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern void sv_terminal __P((char *)); | 
					
						
							|  |  |  | extern void sv_hostfile __P((char *)); | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | extern void sv_winsize __P((char *)); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | #if defined (__CYGWIN__)
 | 
					
						
							|  |  |  | extern void sv_home __P((char *)); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if defined (HISTORY)
 | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern void sv_histsize __P((char *)); | 
					
						
							|  |  |  | extern void sv_histignore __P((char *)); | 
					
						
							|  |  |  | extern void sv_history_control __P((char *)); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | #  if defined (BANG_HISTORY)
 | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern void sv_histchars __P((char *)); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2004-07-27 13:29:18 +00:00
										 |  |  | extern void sv_histtimefmt __P((char *)); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | #endif /* HISTORY */
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | #if defined (HAVE_TZSET)
 | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | extern void sv_tz __P((char *)); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-26 09:36:43 -05:00
										 |  |  | #if defined (JOB_CONTROL)
 | 
					
						
							|  |  |  | extern void sv_childmax __P((char *)); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | #endif /* !_VARIABLES_H_ */
 |