optimise error messages, option parsing, and make more builtins

recognise "--", costs us 20 .text 0 .data 0 .bss
This commit is contained in:
tg
2010-09-05 19:51:35 +00:00
parent 07b97d5444
commit 56a69907d5
6 changed files with 51 additions and 48 deletions

8
exec.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.80 2010/08/28 20:22:17 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.81 2010/09/05 19:51:32 tg Exp $");
#ifndef MKSH_DEFAULT_EXECSHELL
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
@ -444,12 +444,12 @@ comexec(struct op *t, struct tbl *volatile tp, const char **ap,
/* undo effects of command */
fcflags = FC_BI|FC_FUNC|FC_PATH;
if (tp->val.f == c_builtin) {
if ((cp = *++ap) == NULL) {
if ((cp = *++ap) == NULL ||
(!strcmp(cp, "--") && (cp = *++ap) == NULL)) {
tp = NULL;
break;
}
tp = findcom(cp, FC_BI);
if (tp == NULL)
if ((tp = findcom(cp, FC_BI)) == NULL)
errorf("%s: %s: %s", T_builtin, cp, "not a builtin");
continue;
} else if (tp->val.f == c_exec) {