1/* builtins.h -- What a builtin looks like, and where to find them. */ 2 3/* Copyright (C) 1987-2009 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 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. 11 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. 16 17 You should have received a copy of the GNU General Public License 18 along with Bash. If not, see <http://www.gnu.org/licenses/>. 19*/ 20 21#include "config.h" 22 23#if defined (HAVE_UNISTD_H) 24# ifdef _MINIX 25# include <sys/types.h> 26# endif 27# include <unistd.h> 28#endif 29 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 0x01 /* This builtin is enabled. */ 39#define BUILTIN_DELETED 0x02 /* This has been deleted with enable -d. */ 40#define STATIC_BUILTIN 0x04 /* This builtin is not dynamically loaded. */ 41#define SPECIAL_BUILTIN 0x08 /* This is a Posix `special' builtin. */ 42#define ASSIGNMENT_BUILTIN 0x10 /* This builtin takes assignment statements. */ 43#define POSIX_BUILTIN 0x20 /* This builtins is special in the Posix command search order. */ 44 45#define BASE_INDENT 4 46 47/* The thing that we build the array of builtins out of. */ 48struct builtin { 49 char *name; /* The name that the user types. */ 50 sh_builtin_func_t *function; /* The address of the invoked function. */ 51 int flags; /* One of the #defines above. */ 52 char * const *long_doc; /* NULL terminated array of strings. */ 53 const char *short_doc; /* Short version of documenation. */ 54 char *handle; /* for future use */ 55}; 56 57/* Found in builtins.c, created by builtins/mkbuiltins. */ 58extern int num_shell_builtins; /* Number of shell builtins. */ 59extern struct builtin static_shell_builtins[]; 60extern struct builtin *shell_builtins; 61extern struct builtin *current_builtin; 62