xref: /titanic_41/usr/src/lib/libast/i386/include/ast/shcmd.h (revision 721df37ded2cce623b0249cc35a872c3ce291b9b)
1 
2 /* : : generated by proto : : */
3 /***********************************************************************
4 *                                                                      *
5 *               This software is part of the ast package               *
6 *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
7 *                      and is licensed under the                       *
8 *                  Common Public License, Version 1.0                  *
9 *                    by AT&T Intellectual Property                     *
10 *                                                                      *
11 *                A copy of the License is available at                 *
12 *            http://www.opensource.org/licenses/cpl1.0.txt             *
13 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
14 *                                                                      *
15 *              Information and Software Systems Research               *
16 *                            AT&T Research                             *
17 *                           Florham Park NJ                            *
18 *                                                                      *
19 *                 Glenn Fowler <gsf@research.att.com>                  *
20 *                  David Korn <dgk@research.att.com>                   *
21 *                   Phong Vo <kpv@research.att.com>                    *
22 *                                                                      *
23 ***********************************************************************/
24 
25 
26 /*
27  * ksh builtin command api
28  */
29 
30 #ifndef _SHCMD_H
31 #if !defined(__PROTO__)
32 #include <prototyped.h>
33 #endif
34 #if !defined(__LINKAGE__)
35 #define __LINKAGE__		/* 2004-08-11 transition */
36 #endif
37 
38 #define _SHCMD_H	1
39 
40 #ifndef SH_VERSION
41 #   define Shell_t	void
42 #endif
43 #ifndef NV_DEFAULT
44 #   define Namval_t	void
45 #endif
46 #ifndef ERROR_NOTIFY
47 #   define ERROR_NOTIFY	1
48 #endif
49 
50 typedef int (*Shbltin_f) __PROTO__((int, char**, __V_*));
51 
52 #undef Shbltin_t
53 typedef struct Shbltin_s
54 {
55 	Shell_t		*shp;
56 	__V_		*ptr;
57 	int		version;
58 	int		(*shrun) __PROTO__((int, char**));
59 	int		(*shtrap) __PROTO__((const char*, int));
60 	void		(*shexit) __PROTO__((int));
61 	Namval_t	*(*shbltin) __PROTO__((const char*, Shbltin_f, __V_*));
62 	unsigned char	notify;
63 	unsigned char	sigset;
64 	unsigned char	nosfio;
65 	Namval_t	*bnode;
66 	Namval_t	*vnode;
67 	char		*data;
68 	int		flags;
69 	char		*(*shgetenv) __PROTO__((const char*));
70 	char		*(*shsetenv) __PROTO__((const char*));
71 	int		invariant;
72 } Shbltin_t;
73 
74 #if defined(SH_VERSION) ||  defined(_SH_PRIVATE)
75 #   undef Shell_t
76 #   undef Namval_t
77 #else
78 #   define sh_context(c)	((Shbltin_t*)(c))
79 #   define sh_run(c, ac, av)	((c)?(*sh_context(c)->shrun)(ac,av):-1)
80 #   define sh_system(c,str)	((c)?(*sh_context(c)->shtrap)(str,0):system(str))
81 #   define sh_exit(c,n)		((c)?(*sh_context(c)->shexit)(n):exit(n))
82 #   define sh_checksig(c)	((c) && sh_context(c)->sigset)
83 #   if defined(SFIO_VERSION) || defined(_AST_H)
84 #	define LIB_INIT(c)
85 #   else
86 #	define LIB_INIT(c)	((c) && (sh_context(c)->nosfio = 1))
87 #   endif
88 #   ifndef _CMD_H
89 #	define cmdinit(ac,av,c,cat,flg)		do { if((ac)<=0) return(0); \
90 	    (sh_context(c)->notify = ((flg)&ERROR_NOTIFY)?1:0);} while(0)
91 #   endif
92 #endif
93 
94 #if _BLD_ast && defined(__EXPORT__)
95 #undef __MANGLE__
96 #define __MANGLE__ __LINKAGE__		__EXPORT__
97 #endif
98 
99 extern __MANGLE__ int		astintercept __PROTO__((Shbltin_t*, int));
100 
101 #undef __MANGLE__
102 #define __MANGLE__ __LINKAGE__
103 
104 #endif
105