2 /* : : generated by proto : : */
3 /***********************************************************************
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 *
11 * A copy of the License is available at *
12 * http://www.opensource.org/licenses/cpl1.0.txt *
13 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
15 * Information and Software Systems Research *
19 * Glenn Fowler <gsf@research.att.com> *
20 * David Korn <dgk@research.att.com> *
21 * Phong Vo <kpv@research.att.com> *
23 ***********************************************************************/
27 * ksh builtin command api
31 #if !defined(__PROTO__)
32 #include <prototyped.h>
34 #if !defined(__LINKAGE__)
35 #define __LINKAGE__ /* 2004-08-11 transition */
44 # define Namval_t void
47 # define ERROR_NOTIFY 1
50 typedef int (*Shbltin_f
) __PROTO__((int, char**, __V_
*));
53 typedef struct Shbltin_s
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_
*));
69 char *(*shgetenv
) __PROTO__((const char*));
70 char *(*shsetenv
) __PROTO__((const char*));
74 #if defined(SH_VERSION) || defined(_SH_PRIVATE)
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)
86 # define LIB_INIT(c) ((c) && (sh_context(c)->nosfio = 1))
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)
94 #if _BLD_ast && defined(__EXPORT__)
96 #define __MANGLE__ __LINKAGE__ __EXPORT__
99 extern __MANGLE__
int astintercept
__PROTO__((Shbltin_t
*, int));
102 #define __MANGLE__ __LINKAGE__