1 /*********************************************************************** 2 * * 3 * This software is part of the ast package * 4 * Copyright (c) 1982-2013 AT&T Intellectual Property * 5 * and is licensed under the * 6 * Eclipse Public License, Version 1.0 * 7 * by AT&T Intellectual Property * 8 * * 9 * A copy of the License is available at * 10 * http://www.eclipse.org/org/documents/epl-v10.html * 11 * (with md5 checksum b35adb5213ca9657e911e9befb180842) * 12 * * 13 * Information and Software Systems Research * 14 * AT&T Research * 15 * Florham Park NJ * 16 * * 17 * David Korn <dgkorn@gmail.com> * 18 * * 19 ***********************************************************************/ 20 // 21 // David Korn 22 // AT&T Labs 23 // 24 // Interface definitions read-only data tables for shell. 25 // 26 #ifndef _SHTABLE_H 27 #define _SHTABLE_H 1 28 29 #include "shcmd.h" 30 31 typedef struct shtable1 { 32 const char *sh_name; 33 const unsigned sh_number; 34 } Shtable_t; 35 36 struct shtable2 { 37 const char *sh_name; 38 const unsigned sh_number; 39 const char *sh_value; 40 }; 41 42 // This must be the same shape as struct shtable2 due to type aliasing in one call of inittree(). 43 struct shtable3 { 44 const char *sh_name; 45 const unsigned sh_number; 46 int (*sh_value)(int, char *[], Shbltin_t *); 47 }; 48 49 struct shtable4 { 50 const int sig; 51 const int code; 52 const char *str; 53 }; 54 55 #define sh_lookup(name, value) (sh_locate(name, (Shtable_t *)(value), sizeof(*(value)))->sh_number) 56 extern const Shtable_t shtab_testops[]; 57 extern const Shtable_t shtab_options[]; 58 extern const Shtable_t shtab_attributes[]; 59 extern const struct shtable2 shtab_variables[]; 60 extern const struct shtable2 shtab_aliases[]; 61 extern const struct shtable2 shtab_signals[]; 62 extern const struct shtable3 shtab_builtins[]; 63 extern const struct shtable4 shtab_siginfo_codes[]; 64 extern const Shtable_t shtab_reserved[]; 65 extern const Shtable_t *sh_locate(const char *, const Shtable_t *, int); 66 extern int sh_lookopt(const char *, int *); 67 68 #endif // _SHTABLE_H 69