| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | /* common.h -- extern declarations for functions defined in common.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 (__COMMON_H)
 | 
					
						
							|  |  |  | #  define __COMMON_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | #include "stdc.h"
 | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | #define ISOPTION(s, c)	(s[0] == '-' && !s[2] && s[1] == c)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 |  |  | /* Flag values for parse_and_execute () */ | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | #define SEVAL_NONINT	0x001
 | 
					
						
							|  |  |  | #define SEVAL_INTERACT	0x002
 | 
					
						
							|  |  |  | #define SEVAL_NOHIST	0x004
 | 
					
						
							|  |  |  | #define SEVAL_NOFREE	0x008
 | 
					
						
							| 
									
										
										
										
											2004-07-27 13:29:18 +00:00
										 |  |  | #define SEVAL_RESETLINE	0x010
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | #define SEVAL_PARSEONLY	0x020
 | 
					
						
							|  |  |  | #define SEVAL_NOLONGJMP 0x040
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Flags for describe_command, shared between type.def and command.def */ | 
					
						
							|  |  |  | #define CDESC_ALL		0x001	/* type -a */
 | 
					
						
							|  |  |  | #define CDESC_SHORTDESC		0x002	/* command -V */
 | 
					
						
							|  |  |  | #define CDESC_REUSABLE		0x004	/* command -v */
 | 
					
						
							|  |  |  | #define CDESC_TYPE		0x008	/* type -t */
 | 
					
						
							|  |  |  | #define CDESC_PATH_ONLY		0x010	/* type -p */
 | 
					
						
							|  |  |  | #define CDESC_FORCE_PATH	0x020	/* type -ap or type -P */
 | 
					
						
							|  |  |  | #define CDESC_NOFUNCS		0x040	/* type -f */
 | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | #define CDESC_ABSPATH		0x080	/* convert to absolute path, no ./ */
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Flags for get_job_by_name */ | 
					
						
							|  |  |  | #define JM_PREFIX		0x01	/* prefix of job name */
 | 
					
						
							|  |  |  | #define JM_SUBSTRING		0x02	/* substring of job name */
 | 
					
						
							|  |  |  | #define JM_EXACT		0x04	/* match job name exactly */
 | 
					
						
							|  |  |  | #define JM_STOPPED		0x08	/* match stopped jobs only */
 | 
					
						
							|  |  |  | #define JM_FIRSTMATCH		0x10	/* return first matching job */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Flags for remember_args and value of changed_dollar_vars */ | 
					
						
							|  |  |  | #define ARGS_NONE		0x0
 | 
					
						
							|  |  |  | #define ARGS_INVOC		0x01
 | 
					
						
							|  |  |  | #define ARGS_FUNC		0x02
 | 
					
						
							|  |  |  | #define ARGS_SETBLTIN		0x04
 | 
					
						
							| 
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | /* Functions from common.c */ | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern void builtin_error __P((const char *, ...))  __attribute__((__format__ (printf, 1, 2))); | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | extern void builtin_warning __P((const char *, ...))  __attribute__((__format__ (printf, 1, 2))); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern void builtin_usage __P((void)); | 
					
						
							|  |  |  | extern void no_args __P((WORD_LIST *)); | 
					
						
							|  |  |  | extern int no_options __P((WORD_LIST *)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | /* common error message functions */ | 
					
						
							|  |  |  | extern void sh_needarg __P((char *)); | 
					
						
							|  |  |  | extern void sh_neednumarg __P((char *)); | 
					
						
							|  |  |  | extern void sh_notfound __P((char *)); | 
					
						
							|  |  |  | extern void sh_invalidopt __P((char *)); | 
					
						
							|  |  |  | extern void sh_invalidoptname __P((char *)); | 
					
						
							|  |  |  | extern void sh_invalidid __P((char *)); | 
					
						
							|  |  |  | extern void sh_invalidnum __P((char *)); | 
					
						
							|  |  |  | extern void sh_invalidsig __P((char *)); | 
					
						
							|  |  |  | extern void sh_erange __P((char *, char *)); | 
					
						
							|  |  |  | extern void sh_badpid __P((char *)); | 
					
						
							|  |  |  | extern void sh_badjob __P((char *)); | 
					
						
							|  |  |  | extern void sh_readonly __P((const char *)); | 
					
						
							|  |  |  | extern void sh_nojobs __P((char *)); | 
					
						
							|  |  |  | extern void sh_restricted __P((char *)); | 
					
						
							| 
									
										
										
										
											2004-07-27 13:29:18 +00:00
										 |  |  | extern void sh_notbuiltin __P((char *)); | 
					
						
							| 
									
										
										
										
											2005-12-07 14:08:12 +00:00
										 |  |  | extern void sh_wrerror __P((void)); | 
					
						
							| 
									
										
										
										
											2009-02-19 22:21:29 +00:00
										 |  |  | extern void sh_ttyerror __P((int)); | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | extern int sh_chkwrite __P((int)); | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern char **make_builtin_argv __P((WORD_LIST *, int *)); | 
					
						
							|  |  |  | extern void remember_args __P((WORD_LIST *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern int dollar_vars_changed __P((void)); | 
					
						
							|  |  |  | extern void set_dollar_vars_unchanged __P((void)); | 
					
						
							|  |  |  | extern void set_dollar_vars_changed __P((void)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | extern int get_numeric_arg __P((WORD_LIST *, int, intmax_t *)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern int get_exitstat __P((WORD_LIST *)); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern int read_octal __P((char *)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Keeps track of the current working directory. */ | 
					
						
							|  |  |  | extern char *the_current_working_directory; | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern char *get_working_directory __P((char *)); | 
					
						
							|  |  |  | extern void set_working_directory __P((char *)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #if defined (JOB_CONTROL)
 | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern int get_job_by_name __P((const char *, int)); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern int get_job_spec __P((WORD_LIST *)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern int display_signal_list __P((WORD_LIST *, int)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* It's OK to declare a function as returning a Function * without
 | 
					
						
							|  |  |  |    providing a definition of what a `Function' is. */ | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern struct builtin *builtin_address_internal __P((char *, int)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern sh_builtin_func_t *find_shell_builtin __P((char *)); | 
					
						
							|  |  |  | extern sh_builtin_func_t *builtin_address __P((char *)); | 
					
						
							|  |  |  | extern sh_builtin_func_t *find_special_builtin __P((char *)); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern void initialize_shell_builtins __P((void)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-27 13:29:18 +00:00
										 |  |  | /* Functions from exit.def */ | 
					
						
							|  |  |  | extern void bash_logout __P((void)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | /* Functions from getopts.def */ | 
					
						
							|  |  |  | extern void getopts_reset __P((int)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | /* Functions from set.def */ | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern int minus_o_option_value __P((char *)); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern void list_minus_o_opts __P((int, int)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern char **get_minus_o_opts __P((void)); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern int set_minus_o_option __P((int, char *)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | extern void set_shellopts __P((void)); | 
					
						
							|  |  |  | extern void parse_shellopts __P((char *)); | 
					
						
							|  |  |  | extern void initialize_shell_options __P((int)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern void reset_shell_options __P((void)); | 
					
						
							| 
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Functions from shopt.def */ | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern void reset_shopt_options __P((void)); | 
					
						
							| 
									
										
										
										
											2000-03-17 21:46:59 +00:00
										 |  |  | extern char **get_shopt_options __P((void)); | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern int shopt_setopt __P((char *, int)); | 
					
						
							|  |  |  | extern int shopt_listopt __P((char *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-21 20:51:19 -05:00
										 |  |  | extern int set_login_shell __P((char *, int)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern void set_bashopts __P((void)); | 
					
						
							|  |  |  | extern void parse_bashopts __P((char *)); | 
					
						
							|  |  |  | extern void initialize_bashopts __P((int)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | /* Functions from type.def */ | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern int describe_command __P((char *, int)); | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Functions from setattr.def */ | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern int set_or_show_attributes __P((WORD_LIST *, int, int)); | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | extern int show_all_var_attributes __P((int, int)); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern int show_var_attributes __P((SHELL_VAR *, int, int)); | 
					
						
							|  |  |  | extern int show_name_attributes __P((char *, int)); | 
					
						
							|  |  |  | extern void set_var_attribute __P((char *, int, int)); | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Functions from pushd.def */ | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern char *get_dirstack_from_string __P((char *)); | 
					
						
							| 
									
										
										
										
											2002-07-17 14:10:11 +00:00
										 |  |  | extern char *get_dirstack_element __P((intmax_t, int)); | 
					
						
							|  |  |  | extern void set_dirstack_element __P((intmax_t, int, char *)); | 
					
						
							| 
									
										
										
										
											2006-10-10 14:15:34 +00:00
										 |  |  | extern WORD_LIST *get_directory_stack __P((int)); | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Functions from evalstring.c */ | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern int parse_and_execute __P((char *, const char *, int)); | 
					
						
							| 
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 |  |  | extern void parse_and_execute_cleanup __P((void)); | 
					
						
							| 
									
										
										
										
											2009-01-12 13:36:28 +00:00
										 |  |  | extern int parse_string __P((char *, const char *, int, char **)); | 
					
						
							| 
									
										
										
										
											1996-12-23 17:02:34 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Functions from evalfile.c */ | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern int maybe_execute_file __P((const char *, int)); | 
					
						
							| 
									
										
										
										
											2004-07-27 13:29:18 +00:00
										 |  |  | extern int source_file __P((const char *, int)); | 
					
						
							| 
									
										
										
										
											2001-11-13 17:56:06 +00:00
										 |  |  | extern int fc_execute_file __P((const char *)); | 
					
						
							| 
									
										
										
										
											1996-08-26 18:22:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif /* !__COMMON_H */
 |