add “\builtin” utility
This commit is contained in:
10
main.c
10
main.c
@ -34,7 +34,7 @@
|
||||
#include <locale.h>
|
||||
#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 */
|
||||
|
Reference in New Issue
Block a user