]> git.ipfire.org Git - thirdparty/bash.git/blame - trap.h
Imported from ../bash-2.05a.tar.gz.
[thirdparty/bash.git] / trap.h
CommitLineData
726f6388
JA
1/* trap.h -- data structures used in the trap mechanism. */
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
bb70624e 19 Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
726f6388 20
ccc6cda3
JA
21#if !defined (_TRAP_H_)
22#define _TRAP_H_
726f6388
JA
23
24#include "stdc.h"
25
26#if !defined (SIG_DFL)
d166f048 27#include "bashtypes.h"
726f6388
JA
28#include <signal.h>
29#endif /* SIG_DFL */
30
31#if !defined (NSIG)
32#define NSIG 64
33#endif /* !NSIG */
34
35#define NO_SIG -1
36#define DEFAULT_SIG SIG_DFL
37#define IGNORE_SIG SIG_IGN
38
ccc6cda3
JA
39/* Special shell trap names. */
40#define DEBUG_TRAP NSIG
f73dda09 41#define ERROR_TRAP NSIG+1
ccc6cda3
JA
42#define EXIT_TRAP 0
43
f73dda09
JA
44/* system signals plus special bash traps */
45#define BASH_NSIG NSIG+2
46
726f6388
JA
47#define signal_object_p(x) (decode_signal (x) != NO_SIG)
48
f73dda09
JA
49#define TRAP_STRING(s) \
50 (signal_is_trapped (s) && signal_is_ignored (s) == 0) ? trap_list[s] \
51 : (char *)NULL
52
ccc6cda3 53extern char *trap_list[];
726f6388
JA
54
55/* Externally-visible functions declared in trap.c. */
56extern void initialize_traps __P((void));
57extern void run_pending_traps __P((void));
58extern void maybe_set_sigchld_trap __P((char *));
59extern void set_sigchld_trap __P((char *));
ccc6cda3 60extern void set_debug_trap __P((char *));
f73dda09 61extern void set_error_trap __P((char *));
ccc6cda3 62extern void set_sigint_trap __P((char *));
726f6388
JA
63extern void set_signal __P((int, char *));
64extern void restore_default_signal __P((int));
65extern void ignore_signal __P((int));
66extern int run_exit_trap __P((void));
ccc6cda3
JA
67extern void run_trap_cleanup __P((int));
68extern void run_debug_trap __P((void));
f73dda09 69extern void run_error_trap __P((void));
726f6388
JA
70extern void free_trap_strings __P((void));
71extern void reset_signal_handlers __P((void));
72extern void restore_original_signals __P((void));
73
74extern char *signal_name __P((int));
75
76extern int decode_signal __P((char *));
77extern void run_interrupt_trap __P((void));
78extern int maybe_call_trap_handler __P((int));
79extern int signal_is_trapped __P((int));
726f6388 80extern int signal_is_ignored __P((int));
ccc6cda3
JA
81extern int signal_is_special __P((int));
82extern void set_signal_ignored __P((int));
726f6388 83
ccc6cda3 84#endif /* _TRAP_H_ */