]> git.ipfire.org Git - thirdparty/bash.git/blob - builtins/common.h
Imported from ../bash-2.05b.tar.gz.
[thirdparty/bash.git] / builtins / common.h
1 /* common.h -- extern declarations for functions defined in common.c. */
2
3 /* Copyright (C) 1993-2002 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
19 Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
20
21 #if !defined (__COMMON_H)
22 # define __COMMON_H
23
24 #include "stdc.h"
25
26 #define ISOPTION(s, c) (s[0] == '-' && !s[2] && s[1] == c)
27
28 /* Flag values for parse_and_execute () */
29 #define SEVAL_NONINT 0x001
30 #define SEVAL_INTERACT 0x002
31 #define SEVAL_NOHIST 0x004
32 #define SEVAL_NOFREE 0x008
33
34 /* Flags for describe_command, shared between type.def and command.def */
35 #define CDESC_ALL 0x001 /* type -a */
36 #define CDESC_SHORTDESC 0x002 /* command -V */
37 #define CDESC_REUSABLE 0x004 /* command -v */
38 #define CDESC_TYPE 0x008 /* type -t */
39 #define CDESC_PATH_ONLY 0x010 /* type -p */
40 #define CDESC_FORCE_PATH 0x020 /* type -ap or type -P */
41 #define CDESC_NOFUNCS 0x040 /* type -f */
42
43 /* Flags for get_job_by_name */
44 #define JM_PREFIX 0x01 /* prefix of job name */
45 #define JM_SUBSTRING 0x02 /* substring of job name */
46 #define JM_EXACT 0x04 /* match job name exactly */
47 #define JM_STOPPED 0x08 /* match stopped jobs only */
48 #define JM_FIRSTMATCH 0x10 /* return first matching job */
49
50 /* Flags for remember_args and value of changed_dollar_vars */
51 #define ARGS_NONE 0x0
52 #define ARGS_INVOC 0x01
53 #define ARGS_FUNC 0x02
54 #define ARGS_SETBLTIN 0x04
55
56 /* Functions from common.c */
57 extern void builtin_error __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
58 extern void builtin_usage __P((void));
59 extern void no_args __P((WORD_LIST *));
60 extern int no_options __P((WORD_LIST *));
61
62 /* common error message functions */
63 extern void sh_needarg __P((char *));
64 extern void sh_neednumarg __P((char *));
65 extern void sh_notfound __P((char *));
66 extern void sh_invalidopt __P((char *));
67 extern void sh_invalidoptname __P((char *));
68 extern void sh_invalidid __P((char *));
69 extern void sh_invalidnum __P((char *));
70 extern void sh_invalidsig __P((char *));
71 extern void sh_erange __P((char *, char *));
72 extern void sh_badpid __P((char *));
73 extern void sh_badjob __P((char *));
74 extern void sh_readonly __P((const char *));
75 extern void sh_nojobs __P((char *));
76 extern void sh_restricted __P((char *));
77
78 extern char **make_builtin_argv __P((WORD_LIST *, int *));
79 extern void remember_args __P((WORD_LIST *, int));
80
81 extern int dollar_vars_changed __P((void));
82 extern void set_dollar_vars_unchanged __P((void));
83 extern void set_dollar_vars_changed __P((void));
84
85 extern intmax_t get_numeric_arg __P((WORD_LIST *, int));
86 extern int get_exitstat __P((WORD_LIST *));
87 extern int read_octal __P((char *));
88
89 /* Keeps track of the current working directory. */
90 extern char *the_current_working_directory;
91 extern char *get_working_directory __P((char *));
92 extern void set_working_directory __P((char *));
93
94 #if defined (JOB_CONTROL)
95 extern int get_job_by_name __P((const char *, int));
96 extern int get_job_spec __P((WORD_LIST *));
97 #endif
98 extern int display_signal_list __P((WORD_LIST *, int));
99
100 /* It's OK to declare a function as returning a Function * without
101 providing a definition of what a `Function' is. */
102 extern struct builtin *builtin_address_internal __P((char *, int));
103 extern sh_builtin_func_t *find_shell_builtin __P((char *));
104 extern sh_builtin_func_t *builtin_address __P((char *));
105 extern sh_builtin_func_t *find_special_builtin __P((char *));
106 extern void initialize_shell_builtins __P((void));
107
108 /* Functions from getopts.def */
109 extern void getopts_reset __P((int));
110
111 /* Functions from set.def */
112 extern int minus_o_option_value __P((char *));
113 extern void list_minus_o_opts __P((int, int));
114 extern char **get_minus_o_opts __P((void));
115 extern int set_minus_o_option __P((int, char *));
116
117 extern void set_shellopts __P((void));
118 extern void parse_shellopts __P((char *));
119 extern void initialize_shell_options __P((int));
120
121 extern void reset_shell_options __P((void));
122
123 /* Functions from shopt.def */
124 extern void reset_shopt_options __P((void));
125 extern char **get_shopt_options __P((void));
126
127 extern int shopt_setopt __P((char *, int));
128 extern int shopt_listopt __P((char *, int));
129
130 extern int set_login_shell __P((int));
131
132 /* Functions from type.def */
133 extern int describe_command __P((char *, int));
134
135 /* Functions from setattr.def */
136 extern int set_or_show_attributes __P((WORD_LIST *, int, int));
137 extern int show_var_attributes __P((SHELL_VAR *, int, int));
138 extern int show_name_attributes __P((char *, int));
139 extern void set_var_attribute __P((char *, int, int));
140
141 /* Functions from pushd.def */
142 extern char *get_dirstack_from_string __P((char *));
143 extern char *get_dirstack_element __P((intmax_t, int));
144 extern void set_dirstack_element __P((intmax_t, int, char *));
145 extern WORD_LIST *get_directory_stack __P((void));
146
147 /* Functions from evalstring.c */
148 extern int parse_and_execute __P((char *, const char *, int));
149 extern void parse_and_execute_cleanup __P((void));
150
151 /* Functions from evalfile.c */
152 extern int maybe_execute_file __P((const char *, int));
153 extern int source_file __P((const char *));
154 extern int fc_execute_file __P((const char *));
155
156 #endif /* !__COMMON_H */