From 950df6491dd7f7ce3a823927bbe07cd4d1593c9a Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 11 Mar 2017 23:22:36 +0000 Subject: [PATCH] =?UTF-8?q?add=20=E2=80=9C\builtin=E2=80=9D=20utility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exec.c | 11 +++++------ funcs.c | 3 ++- main.c | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/exec.c b/exec.c index a99a3c7..85e930c 100644 --- a/exec.c +++ b/exec.c @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.188 2017/03/11 22:58:51 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.189 2017/03/11 23:22:34 tg Exp $"); #ifndef MKSH_DEFAULT_EXECSHELL #define MKSH_DEFAULT_EXECSHELL MKSH_UNIXROOT "/bin/sh" @@ -978,13 +978,12 @@ scriptexec(struct op *tp, const char **ap) errorf(Tf_sD_sD_s, tp->str, sh, cstrerror(errno)); } +/* actual 'builtin' built-in utility call is handled in comexec() */ int -shcomexec(const char **wp) +c_builtin(const char **wp) { - struct tbl *tp; - - tp = ktsearch(&builtins, *wp, hash(*wp)); - return (call_builtin(tp, wp, "shcomexec", false)); + return (call_builtin(ktsearch(&builtins, *wp, hash(*wp)), wp, + Tbuiltin, false)); } /* diff --git a/funcs.c b/funcs.c index 2bfa30c..d38288d 100644 --- a/funcs.c +++ b/funcs.c @@ -38,7 +38,7 @@ #endif #endif -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.324 2017/03/11 23:10:40 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.325 2017/03/11 23:22:35 tg Exp $"); #if HAVE_KILLPG /* @@ -100,6 +100,7 @@ const struct builtin mkshbuiltins[] = { /* no =: AT&T manual wrong */ {Talias, c_alias}, {"*=break", c_brkcont}, + {T_builtin, c_builtin}, {Tbuiltin, c_builtin}, {Tbcat, c_cat}, {Tcd, c_cd}, diff --git a/main.c b/main.c index 8701ab2..902cd52 100644 --- a/main.c +++ b/main.c @@ -34,7 +34,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.323 2017/03/11 22:58:51 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.324 2017/03/11 23:22:36 tg Exp $"); extern char **environ; @@ -257,7 +257,7 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp) /* define built-in commands and see if we were called as one */ ktinit(APERM, &builtins, - /* currently up to 54 builtins: 75% of 128 = 2^7 */ + /* currently up to 55 builtins: 75% of 128 = 2^7 */ 7); for (i = 0; mkshbuiltins[i].name != NULL; i++) if (!strcmp(ccp, builtin(mkshbuiltins[i].name, @@ -382,7 +382,7 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp) setstr(vp, current_wd, KSH_RETURN_ERROR); for (wp = initcoms; *wp != NULL; wp++) { - shcomexec(wp); + c_builtin(wp); while (*wp != NULL) wp++; } @@ -627,7 +627,7 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp) } if (restricted_shell) { - shcomexec(restr_com); + c_builtin(restr_com); /* After typeset command... */ Flag(FRESTRICTED) = 1; } @@ -657,7 +657,7 @@ main(int argc, const char *argv[]) if ((rv = main_init(argc, argv, &s, &l)) == 0) { if (Flag(FAS_BUILTIN)) { - rv = shcomexec(l->argv); + rv = c_builtin(l->argv); } else { shell(s, true); /* NOTREACHED */