xref: /titanic_50/usr/src/lib/libast/i386/include/ast/shcmd.h (revision 3e14f97f673e8a630f076077de35afdd43dc1587)
17c2fbfb3SApril Chin 
27c2fbfb3SApril Chin /* : : generated by proto : : */
37c2fbfb3SApril Chin /***********************************************************************
47c2fbfb3SApril Chin *                                                                      *
57c2fbfb3SApril Chin *               This software is part of the ast package               *
6*3e14f97fSRoger A. Faulkner *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
77c2fbfb3SApril Chin *                      and is licensed under the                       *
87c2fbfb3SApril Chin *                  Common Public License, Version 1.0                  *
97c2fbfb3SApril Chin *                    by AT&T Intellectual Property                     *
107c2fbfb3SApril Chin *                                                                      *
117c2fbfb3SApril Chin *                A copy of the License is available at                 *
127c2fbfb3SApril Chin *            http://www.opensource.org/licenses/cpl1.0.txt             *
137c2fbfb3SApril Chin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
147c2fbfb3SApril Chin *                                                                      *
157c2fbfb3SApril Chin *              Information and Software Systems Research               *
167c2fbfb3SApril Chin *                            AT&T Research                             *
177c2fbfb3SApril Chin *                           Florham Park NJ                            *
187c2fbfb3SApril Chin *                                                                      *
197c2fbfb3SApril Chin *                 Glenn Fowler <gsf@research.att.com>                  *
207c2fbfb3SApril Chin *                  David Korn <dgk@research.att.com>                   *
217c2fbfb3SApril Chin *                   Phong Vo <kpv@research.att.com>                    *
227c2fbfb3SApril Chin *                                                                      *
237c2fbfb3SApril Chin ***********************************************************************/
247c2fbfb3SApril Chin 
257c2fbfb3SApril Chin 
267c2fbfb3SApril Chin /*
277c2fbfb3SApril Chin  * ksh builtin command api
287c2fbfb3SApril Chin  */
297c2fbfb3SApril Chin 
307c2fbfb3SApril Chin #ifndef _SHCMD_H
317c2fbfb3SApril Chin #if !defined(__PROTO__)
327c2fbfb3SApril Chin #include <prototyped.h>
337c2fbfb3SApril Chin #endif
347c2fbfb3SApril Chin #if !defined(__LINKAGE__)
357c2fbfb3SApril Chin #define __LINKAGE__		/* 2004-08-11 transition */
367c2fbfb3SApril Chin #endif
377c2fbfb3SApril Chin 
387c2fbfb3SApril Chin #define _SHCMD_H	1
397c2fbfb3SApril Chin 
407c2fbfb3SApril Chin #ifndef SH_VERSION
417c2fbfb3SApril Chin #   define Shell_t	void
427c2fbfb3SApril Chin #endif
437c2fbfb3SApril Chin #ifndef NV_DEFAULT
447c2fbfb3SApril Chin #   define Namval_t	void
457c2fbfb3SApril Chin #endif
467c2fbfb3SApril Chin #ifndef ERROR_NOTIFY
477c2fbfb3SApril Chin #   define ERROR_NOTIFY	1
487c2fbfb3SApril Chin #endif
497c2fbfb3SApril Chin 
507c2fbfb3SApril Chin typedef int (*Shbltin_f) __PROTO__((int, char**, __V_*));
517c2fbfb3SApril Chin 
527c2fbfb3SApril Chin #undef Shbltin_t
537c2fbfb3SApril Chin typedef struct Shbltin_s
547c2fbfb3SApril Chin {
557c2fbfb3SApril Chin 	Shell_t		*shp;
567c2fbfb3SApril Chin 	__V_		*ptr;
577c2fbfb3SApril Chin 	int		version;
587c2fbfb3SApril Chin 	int		(*shrun) __PROTO__((int, char**));
597c2fbfb3SApril Chin 	int		(*shtrap) __PROTO__((const char*, int));
607c2fbfb3SApril Chin 	void		(*shexit) __PROTO__((int));
617c2fbfb3SApril Chin 	Namval_t	*(*shbltin) __PROTO__((const char*, Shbltin_f, __V_*));
627c2fbfb3SApril Chin 	unsigned char	notify;
637c2fbfb3SApril Chin 	unsigned char	sigset;
647c2fbfb3SApril Chin 	unsigned char	nosfio;
657c2fbfb3SApril Chin 	Namval_t	*bnode;
667c2fbfb3SApril Chin 	Namval_t	*vnode;
677c2fbfb3SApril Chin 	char		*data;
687c2fbfb3SApril Chin 	int		flags;
697c2fbfb3SApril Chin 	char		*(*shgetenv) __PROTO__((const char*));
707c2fbfb3SApril Chin 	char		*(*shsetenv) __PROTO__((const char*));
717c2fbfb3SApril Chin 	int		invariant;
727c2fbfb3SApril Chin } Shbltin_t;
737c2fbfb3SApril Chin 
747c2fbfb3SApril Chin #if defined(SH_VERSION) ||  defined(_SH_PRIVATE)
757c2fbfb3SApril Chin #   undef Shell_t
767c2fbfb3SApril Chin #   undef Namval_t
777c2fbfb3SApril Chin #else
7834f9b3eeSRoland Mainz #   define sh_context(c)	((Shbltin_t*)(c))
7934f9b3eeSRoland Mainz #   define sh_run(c, ac, av)	((c)?(*sh_context(c)->shrun)(ac,av):-1)
8034f9b3eeSRoland Mainz #   define sh_system(c,str)	((c)?(*sh_context(c)->shtrap)(str,0):system(str))
8134f9b3eeSRoland Mainz #   define sh_exit(c,n)		((c)?(*sh_context(c)->shexit)(n):exit(n))
8234f9b3eeSRoland Mainz #   define sh_checksig(c)	((c) && sh_context(c)->sigset)
837c2fbfb3SApril Chin #   if defined(SFIO_VERSION) || defined(_AST_H)
847c2fbfb3SApril Chin #	define LIB_INIT(c)
857c2fbfb3SApril Chin #   else
8634f9b3eeSRoland Mainz #	define LIB_INIT(c)	((c) && (sh_context(c)->nosfio = 1))
877c2fbfb3SApril Chin #   endif
887c2fbfb3SApril Chin #   ifndef _CMD_H
897c2fbfb3SApril Chin #	define cmdinit(ac,av,c,cat,flg)		do { if((ac)<=0) return(0); \
9034f9b3eeSRoland Mainz 	    (sh_context(c)->notify = ((flg)&ERROR_NOTIFY)?1:0);} while(0)
917c2fbfb3SApril Chin #   endif
927c2fbfb3SApril Chin #endif
937c2fbfb3SApril Chin 
947c2fbfb3SApril Chin #if _BLD_ast && defined(__EXPORT__)
957c2fbfb3SApril Chin #undef __MANGLE__
967c2fbfb3SApril Chin #define __MANGLE__ __LINKAGE__		__EXPORT__
977c2fbfb3SApril Chin #endif
987c2fbfb3SApril Chin 
997c2fbfb3SApril Chin extern __MANGLE__ int		astintercept __PROTO__((Shbltin_t*, int));
1007c2fbfb3SApril Chin 
1017c2fbfb3SApril Chin #undef __MANGLE__
1027c2fbfb3SApril Chin #define __MANGLE__ __LINKAGE__
1037c2fbfb3SApril Chin 
1047c2fbfb3SApril Chin #endif
105