]>
Commit | Line | Data |
---|---|---|
726f6388 JA |
1 | /* builtins.h -- What a builtin looks like, and where to find them. */ |
2 | ||
3185942a | 3 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. |
726f6388 JA |
4 | |
5 | This file is part of GNU Bash, the Bourne Again SHell. | |
6 | ||
3185942a JA |
7 | Bash is free software: you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation, either version 3 of the License, or | |
10 | (at your option) any later version. | |
726f6388 | 11 | |
3185942a JA |
12 | Bash is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
726f6388 JA |
16 | |
17 | You should have received a copy of the GNU General Public License | |
3185942a JA |
18 | along with Bash. If not, see <http://www.gnu.org/licenses/>. |
19 | */ | |
726f6388 | 20 | |
d233b485 CR |
21 | #ifndef BUILTINS_H |
22 | #define BUILTINS_H | |
23 | ||
726f6388 | 24 | #include "config.h" |
ccc6cda3 JA |
25 | |
26 | #if defined (HAVE_UNISTD_H) | |
cce855bc JA |
27 | # ifdef _MINIX |
28 | # include <sys/types.h> | |
29 | # endif | |
ccc6cda3 JA |
30 | # include <unistd.h> |
31 | #endif | |
32 | ||
726f6388 JA |
33 | #include "command.h" |
34 | #include "general.h" | |
35 | ||
36 | #if defined (ALIAS) | |
37 | #include "alias.h" | |
38 | #endif | |
39 | ||
40 | /* Flags describing various things about a builtin. */ | |
3185942a JA |
41 | #define BUILTIN_ENABLED 0x01 /* This builtin is enabled. */ |
42 | #define BUILTIN_DELETED 0x02 /* This has been deleted with enable -d. */ | |
43 | #define STATIC_BUILTIN 0x04 /* This builtin is not dynamically loaded. */ | |
44 | #define SPECIAL_BUILTIN 0x08 /* This is a Posix `special' builtin. */ | |
ccc6cda3 | 45 | #define ASSIGNMENT_BUILTIN 0x10 /* This builtin takes assignment statements. */ |
3185942a | 46 | #define POSIX_BUILTIN 0x20 /* This builtins is special in the Posix command search order. */ |
a0c0a00f | 47 | #define LOCALVAR_BUILTIN 0x40 /* This builtin creates local variables */ |
726f6388 | 48 | |
95732b49 JA |
49 | #define BASE_INDENT 4 |
50 | ||
726f6388 JA |
51 | /* The thing that we build the array of builtins out of. */ |
52 | struct builtin { | |
53 | char *name; /* The name that the user types. */ | |
7117c2d2 | 54 | sh_builtin_func_t *function; /* The address of the invoked function. */ |
726f6388 | 55 | int flags; /* One of the #defines above. */ |
7117c2d2 | 56 | char * const *long_doc; /* NULL terminated array of strings. */ |
ac50fbac | 57 | const char *short_doc; /* Short version of documentation. */ |
ccc6cda3 | 58 | char *handle; /* for future use */ |
726f6388 JA |
59 | }; |
60 | ||
61 | /* Found in builtins.c, created by builtins/mkbuiltins. */ | |
62 | extern int num_shell_builtins; /* Number of shell builtins. */ | |
ccc6cda3 JA |
63 | extern struct builtin static_shell_builtins[]; |
64 | extern struct builtin *shell_builtins; | |
65 | extern struct builtin *current_builtin; | |
d233b485 CR |
66 | |
67 | #endif /* BUILTINS_H */ |