xref: /titanic_44/usr/src/lib/libshell/common/include/shtable.h (revision a547be5daca7e465ca82df6d179f6b1f8e0cda72)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1982-2010 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
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*[], void*);
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