xref: /illumos-gate/usr/src/contrib/ast/src/cmd/ksh93/include/shtable.h (revision b30d193948be5a7794d7ae3ba0ed9c2f72c88e0f)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1982-2012 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 <dgk@research.att.com>                   *
18 *                                                                      *
19 ***********************************************************************/
20 #pragma prototyped
21 #ifndef _SHTABLE_H
22 
23 /*
24  * David Korn
25  * AT&T Labs
26  *
27  * Interface definitions read-only data tables for shell
28  *
29  */
30 
31 #define _SHTABLE_H	1
32 
33 typedef struct shtable1
34 {
35 	const char	*sh_name;
36 	const unsigned	sh_number;
37 } Shtable_t;
38 
39 struct shtable2
40 {
41 	const char	*sh_name;
42 	const unsigned	sh_number;
43 	const char	*sh_value;
44 };
45 
46 struct shtable3
47 {
48 	const char	*sh_name;
49 	const unsigned	sh_number;
50 	int		(*sh_value)(int, char*[], Shbltin_t*);
51 };
52 
53 #define sh_lookup(name,value)	(sh_locate(name,(Shtable_t*)(value),sizeof(*(value)))->sh_number)
54 extern const Shtable_t		shtab_testops[];
55 extern const Shtable_t		shtab_options[];
56 extern const Shtable_t		shtab_attributes[];
57 extern const struct shtable2	shtab_variables[];
58 extern const struct shtable2	shtab_aliases[];
59 extern const struct shtable2	shtab_signals[];
60 extern const struct shtable3	shtab_builtins[];
61 extern const Shtable_t		shtab_reserved[];
62 extern const Shtable_t		*sh_locate(const char*, const Shtable_t*, int);
63 extern int			sh_lookopt(const char*, int*);
64 
65 #endif /* SH_TABLE_H */
66