Displaying 12 results from an estimated 12 matches for "pathval".
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Small optimisation of command -pv change
...98cbe4d72b
Author: Herbert Xu <herbert at gondor.apana.org.au>
AuthorDate: Fri, 26 Sep 2014 16:47:25 +0800
Committer: Ben Hutchings <ben at decadent.org.uk>
CommitDate: Fri, 25 Jan 2019 02:57:21 +0000
[klibc] [BUILTIN] Small optimisation of command -pv change
This patch moves the pathval call into the describe_command
function and also eliminates an unnecessary branch when DEBUG
is off.
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
usr/dash/exec.c | 12 +++++++-----
1 file changed, 7 insertions(+)...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Small optimisation of command -pv change
...g.au>
AuthorDate: Fri, 26 Sep 2014 16:47:25 +0800
Committer: Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sat, 28 Mar 2020 21:42:54 +0000
[klibc] dash: [BUILTIN] Small optimisation of command -pv change
[ dash commit 29ee27dda68a63ce8b9dccdf2c86f75a4d754b5c ]
This patch moves the pathval call into the describe_command
function and also eliminates an unnecessary branch when DEBUG
is off.
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
usr/dash/exec.c | 12 +++++++-----
1 file changed, 7 insertions(+)...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Replace with listsetvar with mklocal/setvareq
...8 @@ evalcommand(union node *cmd, int flags)
cmd_flag = 0;
execcmd = 0;
spclbltin = -1;
+ vflags = 0;
+ vlocal = 0;
path = NULL;
argc = 0;
@@ -770,6 +773,8 @@ evalcommand(union node *cmd, int flags)
find_command(arglist.list->text, &cmdentry,
cmd_flag | DO_REGBLTIN, pathval());
+ vlocal++;
+
/* implement bltin and command here */
if (cmdentry.cmdtype != CMDBUILTIN)
break;
@@ -780,6 +785,7 @@ evalcommand(union node *cmd, int flags)
cmdentry.u.cmd->flags &
BUILTIN_SPECIAL
;
+ vlocal = spclbltin ^ BUILTIN_SPECIAL;
}
exe...
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] command: allow combining -p with -v
...t output *, char *, int);
+STATIC int describe_command(struct output *, char *, const char *, int);
/*
@@ -727,21 +727,21 @@ typecmd(int argc, char **argv)
int err = 0;
for (i = 1; i < argc; i++) {
- err |= describe_command(out1, argv[i], 1);
+ err |= describe_command(out1, argv[i], pathval(), 1);
}
return err;
}
STATIC int
-describe_command(out, command, verbose)
+describe_command(out, command, path, verbose)
struct output *out;
char *command;
+ const char *path;
int verbose;
{
struct cmdentry entry;
struct tblentry *cmdp;
const struct alias *ap;
- const char *pa...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] command: allow combining -p with -v
...t output *, char *, int);
+STATIC int describe_command(struct output *, char *, const char *, int);
/*
@@ -727,21 +727,21 @@ typecmd(int argc, char **argv)
int err = 0;
for (i = 1; i < argc; i++) {
- err |= describe_command(out1, argv[i], 1);
+ err |= describe_command(out1, argv[i], pathval(), 1);
}
return err;
}
STATIC int
-describe_command(out, command, verbose)
+describe_command(out, command, path, verbose)
struct output *out;
char *command;
+ const char *path;
int verbose;
{
struct cmdentry entry;
struct tblentry *cmdp;
const struct alias *ap;
- const char *pa...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Add assignment built-in support again
...osp = fill_arglist(&arglist, &argp))) {
+ int pseudovarflag = 0;
- spp = arglist.lastp;
- expandarg(argp, &arglist, EXP_FULL | EXP_TILDE);
- for (sp = *spp; sp; sp = sp->next)
+ for (;;) {
+ find_command(arglist.list->text, &cmdentry,
+ cmd_flag | DO_REGBLTIN, pathval());
+
+ /* implement bltin and command here */
+ if (cmdentry.cmdtype != CMDBUILTIN)
+ break;
+
+ pseudovarflag = cmdentry.u.cmd->flags & BUILTIN_ASSIGN;
+ if (likely(spclbltin < 0)) {
+ spclbltin =
+ cmdentry.u.cmd->flags &
+ BUILTIN_SPECIAL
+ ;
+ }
+...
2019 Jan 25
0
[klibc:update-dash] builtin: describe_command - fix incorrect path
...anged, 11 insertions(+), 4 deletions(-)
diff --git a/usr/dash/exec.c b/usr/dash/exec.c
index ec0eadd8..e9e29b7e 100644
--- a/usr/dash/exec.c
+++ b/usr/dash/exec.c
@@ -743,8 +743,6 @@ describe_command(out, command, path, verbose)
struct tblentry *cmdp;
const struct alias *ap;
- path = path ?: pathval();
-
if (verbose) {
outstr(command, out);
}
@@ -767,8 +765,17 @@ describe_command(out, command, path, verbose)
goto out;
}
- /* Then check if it is a tracked alias */
- if ((cmdp = cmdlookup(command, 0)) != NULL) {
+ /* Then if the standard search path is used, check if it is
+ * a t...
2020 Mar 28
0
[klibc:update-dash] dash: builtin: describe_command - fix incorrect path
...anged, 11 insertions(+), 4 deletions(-)
diff --git a/usr/dash/exec.c b/usr/dash/exec.c
index ec0eadd8..e9e29b7e 100644
--- a/usr/dash/exec.c
+++ b/usr/dash/exec.c
@@ -743,8 +743,6 @@ describe_command(out, command, path, verbose)
struct tblentry *cmdp;
const struct alias *ap;
- path = path ?: pathval();
-
if (verbose) {
outstr(command, out);
}
@@ -767,8 +765,17 @@ describe_command(out, command, path, verbose)
goto out;
}
- /* Then check if it is a tracked alias */
- if ((cmdp = cmdlookup(command, 0)) != NULL) {
+ /* Then if the standard search path is used, check if it is
+ * a t...
2020 Mar 28
0
[klibc:update-dash] dash: exec: Do not allocate stack string in padvance
...* "2" is for '/' and '\0' */
@@ -211,7 +210,7 @@ padvance(const char **path, const char *name)
*path = p + 1;
else
*path = NULL;
- return stalloc(len);
+ return len;
}
@@ -266,9 +265,9 @@ printentry(struct tblentry *cmdp)
idx = cmdp->param.index;
path = pathval();
do {
- name = padvance(&path, cmdp->cmdname);
- stunalloc(name);
+ padvance(&path, cmdp->cmdname);
} while (--idx >= 0);
+ name = stackblock();
out1str(name);
out1fmt(snlfmt, cmdp->rehash ? "*" : nullstr);
}
@@ -291,6 +290,7 @@ find_command(char *name, s...
2020 Mar 28
0
[klibc:update-dash] dash: exec: Never rehash regular built-ins
...cmdp = cmdlookup(name, 0)) &&
+ (cmdp->cmdtype == CMDNORMAL ||
+ (cmdp->cmdtype == CMDBUILTIN &&
+ !(cmdp->param.cmd->flags & BUILTIN_REGULAR) &&
+ builtinloc > 0)))
delete_cmd_entry();
find_command(name, &entry, DO_ERR, pathval());
if (entry.cmdtype == CMDUNKNOWN)
@@ -377,7 +379,8 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
bit = DO_NOFUNC;
break;
case CMDBUILTIN:
- bit = DO_ALTBLTIN;
+ bit = cmdp->param.cmd->flags & BUILTIN_REGULAR ?
+ 0 : DO_ALTBLTIN...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Fail immediately with redirections errors for simple command
...p = cmd->ncmd.assign; argp; argp = argp->narg.next) {
struct strlist **spp;
@@ -848,30 +859,19 @@ evalcommand(union node *cmd, int flags)
!(cmdentry.u.cmd->flags & BUILTIN_REGULAR)) {
find_command(argv[0], &cmdentry, cmd_flag | DO_ERR,
unlikely(path) ? path : pathval());
- if (cmdentry.cmdtype == CMDUNKNOWN) {
- status = 127;
-#ifdef FLUSHERR
- flushout(&errout);
-#endif
- goto bail;
- }
- }
-
- if (status) {
-bail:
- exitstatus = status;
-
- /* We have a redirection error. */
- if (spclbltin > 0)
- exraise(EXERROR);
-
- goto out;
}
j...
2020 Mar 28
0
[klibc:update-dash] dash: exec: Stricter pathopt parsing
...{ /* this is a %func directory */
stalloc(len);
readcmdfile(fullname);
if ((cmdp = cmdlookup(name, 0)) == NULL ||
@@ -515,39 +561,26 @@ hashcd(void)
void
changepath(const char *newval)
{
- const char *old, *new;
+ const char *new;
int idx;
- int firstchange;
int bltin;
- old = pathval();
new = newval;
- firstchange = 9999; /* assume no change */
idx = 0;
bltin = -1;
for (;;) {
- if (*old != *new) {
- firstchange = idx;
- if ((*old == '\0' && *new == ':')
- || (*old == ':' && *new == '\0'))
- firstchange++;
- ol...