| Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 1 | /* common.h -- extern declarations for functions defined in common.c. */ |
| 2 | |
| 3 | /* Copyright (C) 1993 Free Software Foundation, Inc. |
| 4 | |
| 5 | This file is part of GNU Bash, the Bourne Again SHell. |
| 6 | |
| 7 | Bash is free software; you can redistribute it and/or modify it under |
| 8 | the terms of the GNU General Public License as published by the Free |
| 9 | Software Foundation; either version 2, or (at your option) any later |
| 10 | version. |
| 11 | |
| 12 | Bash is distributed in the hope that it will be useful, but WITHOUT ANY |
| 13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 15 | for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License along |
| 18 | with Bash; see the file COPYING. If not, write to the Free Software |
| Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 19 | Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ |
| Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 20 | |
| 21 | #if !defined (__COMMON_H) |
| 22 | # define __COMMON_H |
| 23 | |
| Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 24 | #include "stdc.h" |
| Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 25 | |
| Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 26 | #define ISOPTION(s, c) (s[0] == '-' && !s[2] && s[1] == c) |
| 27 | |
| Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 28 | /* Flag values for parse_and_execute () */ |
| 29 | #define SEVAL_NONINT 0x01 |
| 30 | #define SEVAL_INTERACT 0x02 |
| 31 | #define SEVAL_NOHIST 0x04 |
| 32 | |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 33 | /* Functions from common.c */ |
| Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame^] | 34 | extern void builtin_error __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2))); |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 35 | extern void builtin_usage __P((void)); |
| 36 | extern void no_args __P((WORD_LIST *)); |
| 37 | extern void bad_option __P((char *)); |
| 38 | extern int no_options __P((WORD_LIST *)); |
| Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 39 | |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 40 | extern char **make_builtin_argv __P((WORD_LIST *, int *)); |
| 41 | extern void remember_args __P((WORD_LIST *, int)); |
| Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 42 | |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 43 | extern void push_context __P((void)); |
| 44 | extern void pop_context __P((void)); |
| 45 | extern void push_dollar_vars __P((void)); |
| 46 | extern void pop_dollar_vars __P((void)); |
| 47 | extern void dispose_saved_dollar_vars __P((void)); |
| 48 | extern int dollar_vars_changed __P((void)); |
| 49 | extern void set_dollar_vars_unchanged __P((void)); |
| 50 | extern void set_dollar_vars_changed __P((void)); |
| Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 51 | |
| Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame^] | 52 | extern long get_numeric_arg __P((WORD_LIST *, int)); |
| 53 | extern int get_exitstat __P((WORD_LIST *)); |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 54 | extern int read_octal __P((char *)); |
| Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 55 | |
| 56 | /* Keeps track of the current working directory. */ |
| 57 | extern char *the_current_working_directory; |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 58 | extern char *get_working_directory __P((char *)); |
| 59 | extern void set_working_directory __P((char *)); |
| Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 60 | |
| 61 | #if defined (JOB_CONTROL) |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 62 | extern int get_job_spec __P((WORD_LIST *)); |
| Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 63 | #endif |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 64 | extern int display_signal_list __P((WORD_LIST *, int)); |
| Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 65 | |
| 66 | /* It's OK to declare a function as returning a Function * without |
| 67 | providing a definition of what a `Function' is. */ |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 68 | extern struct builtin *builtin_address_internal __P((char *, int)); |
| Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame^] | 69 | extern sh_builtin_func_t *find_shell_builtin __P((char *)); |
| 70 | extern sh_builtin_func_t *builtin_address __P((char *)); |
| 71 | extern sh_builtin_func_t *find_special_builtin __P((char *)); |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 72 | extern void initialize_shell_builtins __P((void)); |
| Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 73 | |
| Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame^] | 74 | /* Functions from getopts.def */ |
| 75 | extern void getopts_reset __P((int)); |
| 76 | |
| Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 77 | /* Functions from set.def */ |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 78 | extern int minus_o_option_value __P((char *)); |
| Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame^] | 79 | extern void list_minus_o_opts __P((int, int)); |
| Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 80 | extern char **get_minus_o_opts __P((void)); |
| Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame^] | 81 | extern int set_minus_o_option __P((int, char *)); |
| 82 | |
| 83 | extern void set_shellopts __P((void)); |
| 84 | extern void parse_shellopts __P((char *)); |
| 85 | extern void initialize_shell_options __P((int)); |
| 86 | |
| 87 | extern void reset_shell_options __P((void)); |
| Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 88 | |
| 89 | /* Functions from shopt.def */ |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 90 | extern void reset_shopt_options __P((void)); |
| Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 91 | extern char **get_shopt_options __P((void)); |
| Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 92 | |
| Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame^] | 93 | extern int shopt_setopt __P((char *, int)); |
| 94 | extern int shopt_listopt __P((char *, int)); |
| 95 | |
| 96 | extern int set_login_shell __P((int)); |
| 97 | |
| Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 98 | /* Functions from type.def */ |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 99 | extern int describe_command __P((char *, int, int)); |
| Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 100 | |
| 101 | /* Functions from setattr.def */ |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 102 | extern int set_or_show_attributes __P((WORD_LIST *, int, int)); |
| 103 | extern int show_var_attributes __P((SHELL_VAR *, int, int)); |
| 104 | extern int show_name_attributes __P((char *, int)); |
| 105 | extern void set_var_attribute __P((char *, int, int)); |
| Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 106 | |
| 107 | /* Functions from pushd.def */ |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 108 | extern char *get_dirstack_from_string __P((char *)); |
| Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame^] | 109 | extern char *get_dirstack_element __P((long, int)); |
| 110 | extern void set_dirstack_element __P((long, int, char *)); |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 111 | extern WORD_LIST *get_directory_stack __P((void)); |
| Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 112 | |
| 113 | /* Functions from evalstring.c */ |
| Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame^] | 114 | extern int parse_and_execute __P((char *, const char *, int)); |
| Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 115 | extern void parse_and_execute_cleanup __P((void)); |
| Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 116 | |
| 117 | /* Functions from evalfile.c */ |
| Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame^] | 118 | extern int maybe_execute_file __P((const char *, int)); |
| 119 | extern int source_file __P((const char *)); |
| 120 | extern int fc_execute_file __P((const char *)); |
| Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 121 | |
| 122 | #endif /* !__COMMON_H */ |