blob: dbebeda0ff7c9fa101b6b4424ac7f803e5e4fbe3 [file] [log] [blame]
Jari Aalto726f6381996-08-26 18:22:31 +00001/* 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 Aaltobb706242000-03-17 21:46:59 +000019 Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
Jari Aalto726f6381996-08-26 18:22:31 +000020
21#if !defined (__COMMON_H)
22# define __COMMON_H
23
Jari Aaltobb706242000-03-17 21:46:59 +000024#include "stdc.h"
Jari Aaltoccc6cda1996-12-23 17:02:34 +000025
Jari Aalto726f6381996-08-26 18:22:31 +000026#define ISOPTION(s, c) (s[0] == '-' && !s[2] && s[1] == c)
27
Jari Aaltod166f041997-06-05 14:59:13 +000028/* Flag values for parse_and_execute () */
29#define SEVAL_NONINT 0x01
30#define SEVAL_INTERACT 0x02
31#define SEVAL_NOHIST 0x04
32
Jari Aaltocce855b1998-04-17 19:52:44 +000033/* Functions from common.c */
Jari Aaltof73dda02001-11-13 17:56:06 +000034extern void builtin_error __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
Jari Aaltocce855b1998-04-17 19:52:44 +000035extern void builtin_usage __P((void));
36extern void no_args __P((WORD_LIST *));
37extern void bad_option __P((char *));
38extern int no_options __P((WORD_LIST *));
Jari Aalto726f6381996-08-26 18:22:31 +000039
Jari Aaltocce855b1998-04-17 19:52:44 +000040extern char **make_builtin_argv __P((WORD_LIST *, int *));
41extern void remember_args __P((WORD_LIST *, int));
Jari Aaltoccc6cda1996-12-23 17:02:34 +000042
Jari Aaltocce855b1998-04-17 19:52:44 +000043extern void push_context __P((void));
44extern void pop_context __P((void));
45extern void push_dollar_vars __P((void));
46extern void pop_dollar_vars __P((void));
47extern void dispose_saved_dollar_vars __P((void));
48extern int dollar_vars_changed __P((void));
49extern void set_dollar_vars_unchanged __P((void));
50extern void set_dollar_vars_changed __P((void));
Jari Aalto726f6381996-08-26 18:22:31 +000051
Jari Aaltof73dda02001-11-13 17:56:06 +000052extern long get_numeric_arg __P((WORD_LIST *, int));
53extern int get_exitstat __P((WORD_LIST *));
Jari Aaltocce855b1998-04-17 19:52:44 +000054extern int read_octal __P((char *));
Jari Aalto726f6381996-08-26 18:22:31 +000055
56/* Keeps track of the current working directory. */
57extern char *the_current_working_directory;
Jari Aaltocce855b1998-04-17 19:52:44 +000058extern char *get_working_directory __P((char *));
59extern void set_working_directory __P((char *));
Jari Aalto726f6381996-08-26 18:22:31 +000060
61#if defined (JOB_CONTROL)
Jari Aaltocce855b1998-04-17 19:52:44 +000062extern int get_job_spec __P((WORD_LIST *));
Jari Aalto726f6381996-08-26 18:22:31 +000063#endif
Jari Aaltocce855b1998-04-17 19:52:44 +000064extern int display_signal_list __P((WORD_LIST *, int));
Jari Aalto726f6381996-08-26 18:22:31 +000065
66/* It's OK to declare a function as returning a Function * without
67 providing a definition of what a `Function' is. */
Jari Aaltocce855b1998-04-17 19:52:44 +000068extern struct builtin *builtin_address_internal __P((char *, int));
Jari Aaltof73dda02001-11-13 17:56:06 +000069extern sh_builtin_func_t *find_shell_builtin __P((char *));
70extern sh_builtin_func_t *builtin_address __P((char *));
71extern sh_builtin_func_t *find_special_builtin __P((char *));
Jari Aaltocce855b1998-04-17 19:52:44 +000072extern void initialize_shell_builtins __P((void));
Jari Aaltoccc6cda1996-12-23 17:02:34 +000073
Jari Aaltof73dda02001-11-13 17:56:06 +000074/* Functions from getopts.def */
75extern void getopts_reset __P((int));
76
Jari Aaltoccc6cda1996-12-23 17:02:34 +000077/* Functions from set.def */
Jari Aaltocce855b1998-04-17 19:52:44 +000078extern int minus_o_option_value __P((char *));
Jari Aaltof73dda02001-11-13 17:56:06 +000079extern void list_minus_o_opts __P((int, int));
Jari Aaltobb706242000-03-17 21:46:59 +000080extern char **get_minus_o_opts __P((void));
Jari Aaltof73dda02001-11-13 17:56:06 +000081extern int set_minus_o_option __P((int, char *));
82
83extern void set_shellopts __P((void));
84extern void parse_shellopts __P((char *));
85extern void initialize_shell_options __P((int));
86
87extern void reset_shell_options __P((void));
Jari Aaltod166f041997-06-05 14:59:13 +000088
89/* Functions from shopt.def */
Jari Aaltocce855b1998-04-17 19:52:44 +000090extern void reset_shopt_options __P((void));
Jari Aaltobb706242000-03-17 21:46:59 +000091extern char **get_shopt_options __P((void));
Jari Aaltoccc6cda1996-12-23 17:02:34 +000092
Jari Aaltof73dda02001-11-13 17:56:06 +000093extern int shopt_setopt __P((char *, int));
94extern int shopt_listopt __P((char *, int));
95
96extern int set_login_shell __P((int));
97
Jari Aaltoccc6cda1996-12-23 17:02:34 +000098/* Functions from type.def */
Jari Aaltocce855b1998-04-17 19:52:44 +000099extern int describe_command __P((char *, int, int));
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000100
101/* Functions from setattr.def */
Jari Aaltocce855b1998-04-17 19:52:44 +0000102extern int set_or_show_attributes __P((WORD_LIST *, int, int));
103extern int show_var_attributes __P((SHELL_VAR *, int, int));
104extern int show_name_attributes __P((char *, int));
105extern void set_var_attribute __P((char *, int, int));
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000106
107/* Functions from pushd.def */
Jari Aaltocce855b1998-04-17 19:52:44 +0000108extern char *get_dirstack_from_string __P((char *));
Jari Aaltof73dda02001-11-13 17:56:06 +0000109extern char *get_dirstack_element __P((long, int));
110extern void set_dirstack_element __P((long, int, char *));
Jari Aaltocce855b1998-04-17 19:52:44 +0000111extern WORD_LIST *get_directory_stack __P((void));
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000112
113/* Functions from evalstring.c */
Jari Aaltof73dda02001-11-13 17:56:06 +0000114extern int parse_and_execute __P((char *, const char *, int));
Jari Aaltocce855b1998-04-17 19:52:44 +0000115extern void parse_and_execute_cleanup __P((void));
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000116
117/* Functions from evalfile.c */
Jari Aaltof73dda02001-11-13 17:56:06 +0000118extern int maybe_execute_file __P((const char *, int));
119extern int source_file __P((const char *));
120extern int fc_execute_file __P((const char *));
Jari Aalto726f6381996-08-26 18:22:31 +0000121
122#endif /* !__COMMON_H */