xref: /titanic_51/usr/src/lib/libast/sparc/include/ast/shcmd.h (revision b453864f3587ccc3324d7a3b0438a1e542dcfde7)
1 
2 /* : : generated by proto : : */
3 /***********************************************************************
4 *                                                                      *
5 *               This software is part of the ast package               *
6 *          Copyright (c) 1985-2008 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_run(c, ac, av)	((c)?(*((Shbltin_t*)(c))->shrun)(ac,av):-1)
79 #   define sh_system(c,str)	((c)?(*((Shbltin_t*)(c))->shtrap)(str,0):system(str))
80 #   define sh_exit(c,n)		((c)?(*((Shbltin_t*)(c))->shexit)(n):exit(n))
81 #   define sh_checksig(c)	((c) && ((Shbltin_t*)(c))->sigset)
82 #   if defined(SFIO_VERSION) || defined(_AST_H)
83 #	define LIB_INIT(c)
84 #   else
85 #	define LIB_INIT(c)	((c) && (((Shbltin_t*)(c))->nosfio = 1))
86 #   endif
87 #   ifndef _CMD_H
88 #	define cmdinit(ac,av,c,cat,flg)		do { if((ac)<=0) return(0); \
89 	    (((Shbltin_t*)(c))->notify = ((flg)&ERROR_NOTIFY)?1:0);} while(0)
90 #   endif
91 #endif
92 
93 #if _BLD_ast && defined(__EXPORT__)
94 #undef __MANGLE__
95 #define __MANGLE__ __LINKAGE__		__EXPORT__
96 #endif
97 
98 extern __MANGLE__ int		astintercept __PROTO__((Shbltin_t*, int));
99 
100 #undef __MANGLE__
101 #define __MANGLE__ __LINKAGE__
102 
103 #endif
104