xref: /onnv-gate/usr/src/lib/libshell/common/include/shtable.h (revision 12068:08a39a083754)
14887Schin /***********************************************************************
24887Schin *                                                                      *
34887Schin *               This software is part of the ast package               *
4*12068SRoger.Faulkner@Oracle.COM *          Copyright (c) 1982-2010 AT&T Intellectual Property          *
54887Schin *                      and is licensed under the                       *
64887Schin *                  Common Public License, Version 1.0                  *
78462SApril.Chin@Sun.COM *                    by AT&T Intellectual Property                     *
84887Schin *                                                                      *
94887Schin *                A copy of the License is available at                 *
104887Schin *            http://www.opensource.org/licenses/cpl1.0.txt             *
114887Schin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
124887Schin *                                                                      *
134887Schin *              Information and Software Systems Research               *
144887Schin *                            AT&T Research                             *
154887Schin *                           Florham Park NJ                            *
164887Schin *                                                                      *
174887Schin *                  David Korn <dgk@research.att.com>                   *
184887Schin *                                                                      *
194887Schin ***********************************************************************/
204887Schin #pragma prototyped
214887Schin #ifndef _SHTABLE_H
224887Schin 
234887Schin /*
244887Schin  * David Korn
254887Schin  * AT&T Labs
264887Schin  *
274887Schin  * Interface definitions read-only data tables for shell
284887Schin  *
294887Schin  */
304887Schin 
314887Schin #define _SHTABLE_H	1
324887Schin 
334887Schin typedef struct shtable1
344887Schin {
354887Schin 	const char	*sh_name;
368462SApril.Chin@Sun.COM 	const unsigned	sh_number;
374887Schin } Shtable_t;
384887Schin 
394887Schin struct shtable2
404887Schin {
414887Schin 	const char	*sh_name;
428462SApril.Chin@Sun.COM 	const unsigned	sh_number;
434887Schin 	const char	*sh_value;
444887Schin };
454887Schin 
464887Schin struct shtable3
474887Schin {
484887Schin 	const char	*sh_name;
498462SApril.Chin@Sun.COM 	const unsigned	sh_number;
504887Schin 	int		(*sh_value)(int, char*[], void*);
514887Schin };
524887Schin 
534887Schin #define sh_lookup(name,value)	(sh_locate(name,(Shtable_t*)(value),sizeof(*(value)))->sh_number)
544887Schin extern const Shtable_t		shtab_testops[];
554887Schin extern const Shtable_t		shtab_options[];
564887Schin extern const Shtable_t		shtab_attributes[];
574887Schin extern const struct shtable2	shtab_variables[];
584887Schin extern const struct shtable2	shtab_aliases[];
594887Schin extern const struct shtable2	shtab_signals[];
604887Schin extern const struct shtable3	shtab_builtins[];
614887Schin extern const Shtable_t		shtab_reserved[];
624887Schin extern const Shtable_t		*sh_locate(const char*, const Shtable_t*, int);
634887Schin extern int			sh_lookopt(const char*, int*);
644887Schin 
654887Schin #endif /* SH_TABLE_H */
66