1 /*********************************************************************** 2 * * 3 * This software is part of the ast package * 4 * Copyright (c) 1985-2013 AT&T Intellectual Property * 5 * and is licensed under the * 6 * Eclipse Public License, Version 1.0 * 7 * by AT&T Intellectual Property * 8 * * 9 * A copy of the License is available at * 10 * http://www.eclipse.org/org/documents/epl-v10.html * 11 * (with md5 checksum b35adb5213ca9657e911e9befb180842) * 12 * * 13 * Information and Software Systems Research * 14 * AT&T Research * 15 * Florham Park NJ * 16 * * 17 * Glenn Fowler <glenn.s.fowler@gmail.com> * 18 * David Korn <dgkorn@gmail.com> * 19 * Phong Vo <phongvo@gmail.com> * 20 * * 21 ***********************************************************************/ 22 // 23 // Ksh builtin command API header. 24 // 25 #ifndef _SHCMD_H 26 #define _SHCMD_H 1 27 28 #include "sfio.h" 29 30 #define SH_PLUGIN_VERSION 20111111L 31 32 // #define SHLIB(m) 33 // unsigned long plugin_version(void) { return SH_PLUGIN_VERSION; } 34 35 struct Shbltin_s { 36 Shell_t *shp; 37 void *ptr; 38 int version; 39 int (*shrun)(Shell_t *, int, char **); 40 void (*shexit)(Shell_t *, int); 41 unsigned char notify; 42 unsigned char sigset; 43 unsigned char nosfio; 44 Namval_t *bnode; 45 Namval_t *vnode; 46 void *data; 47 int flags; 48 int invariant; 49 int pwdfd; 50 }; 51 52 // The following symbols used to have a `sh_` prefix and were meant to mask the functions of the 53 // same name when used in a builtin (e.g., code in src/lib/libcmd). That has been changed because 54 // that sort of redirection obfuscates what is actually happening and makes reasoning about the 55 // code harder. 56 #define bltin_checksig(c) (c && c->sigset) 57 58 extern int cmdinit(int, char **, Shbltin_t *, int); 59 extern Sfdouble_t nget_version(Namval_t *np, Namfun_t *fp); 60 61 #endif // _SHCMD_H 62