Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 1 | /* builtins.h -- What a builtin looks like, and where to find them. */ |
| 2 | |
| 3 | /* Copyright (C) 1987,1991 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 |
| 8 | under the terms of the GNU General Public License as published by |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 9 | the Free Software Foundation; either version 2, or (at your option) |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 10 | any later version. |
| 11 | |
| 12 | Bash is distributed in the hope that it will be useful, but WITHOUT |
| 13 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 14 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 15 | License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with Bash; see the file COPYING. If not, write to the Free |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 19 | Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 20 | |
| 21 | #include "config.h" |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 22 | |
| 23 | #if defined (HAVE_UNISTD_H) |
Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 24 | # ifdef _MINIX |
| 25 | # include <sys/types.h> |
| 26 | # endif |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 27 | # include <unistd.h> |
| 28 | #endif |
| 29 | |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 30 | #include "command.h" |
| 31 | #include "general.h" |
| 32 | |
| 33 | #if defined (ALIAS) |
| 34 | #include "alias.h" |
| 35 | #endif |
| 36 | |
| 37 | /* Flags describing various things about a builtin. */ |
| 38 | #define BUILTIN_ENABLED 0x1 /* This builtin is enabled. */ |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 39 | #define BUILTIN_DELETED 0x2 /* This has been deleted with enable -d. */ |
| 40 | #define STATIC_BUILTIN 0x4 /* This builtin is not dynamically loaded. */ |
| 41 | #define SPECIAL_BUILTIN 0x8 /* This is a Posix `special' builtin. */ |
| 42 | #define ASSIGNMENT_BUILTIN 0x10 /* This builtin takes assignment statements. */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 43 | |
| 44 | /* The thing that we build the array of builtins out of. */ |
| 45 | struct builtin { |
| 46 | char *name; /* The name that the user types. */ |
| 47 | Function *function; /* The address of the invoked function. */ |
| 48 | int flags; /* One of the #defines above. */ |
| 49 | char **long_doc; /* NULL terminated array of strings. */ |
| 50 | char *short_doc; /* Short version of documenation. */ |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 51 | char *handle; /* for future use */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | /* Found in builtins.c, created by builtins/mkbuiltins. */ |
| 55 | extern int num_shell_builtins; /* Number of shell builtins. */ |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 56 | extern struct builtin static_shell_builtins[]; |
| 57 | extern struct builtin *shell_builtins; |
| 58 | extern struct builtin *current_builtin; |