search for: cmdlookup

Displaying 8 results from an estimated 8 matches for "cmdlookup".

Did you mean: cidlookup
2019 Jan 25
0
[klibc:update-dash] builtin: describe_command - fix incorrect path
...t, 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 tracked alias. + */ + if (path == NULL) { + path = pathval(); + cmdp = cmdlookup(command, 0); + } else { + cmdp = NULL; + } + + if (cmdp != NULL) { entry.cmdtype = cmdp->cmdtype; entry.u = cmdp...
2020 Mar 28
0
[klibc:update-dash] dash: exec: Never rehash regular built-ins
...+++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/usr/dash/exec.c b/usr/dash/exec.c index 8948754b..6c0a64f6 100644 --- a/usr/dash/exec.c +++ b/usr/dash/exec.c @@ -287,9 +287,11 @@ hashcmd(int argc, char **argv) } c = 0; while ((name = *argptr) != NULL) { - if ((cmdp = cmdlookup(name, 0)) != NULL - && (cmdp->cmdtype == CMDNORMAL - || (cmdp->cmdtype == CMDBUILTIN && builtinloc >= 0))) + if ((cmdp = cmdlookup(name, 0)) && + (cmdp->cmdtype == CMDNORMAL || + (cmdp->cmdtype == CMDBUILTIN && + !(cmdp->p...
2020 Mar 28
0
[klibc:update-dash] dash: builtin: describe_command - fix incorrect path
...t, 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 tracked alias. + */ + if (path == NULL) { + path = pathval(); + cmdp = cmdlookup(command, 0); + } else { + cmdp = NULL; + } + + if (cmdp != NULL) { entry.cmdtype = cmdp->cmdtype; entry.u = cmdp...
2020 Mar 28
0
[klibc:update-dash] dash: exec: Stricter pathopt parsing
...xec.c +++ b/usr/dash/exec.c @@ -92,7 +92,7 @@ STATIC int builtinloc = -1; /* index in path of %builtin, or -1 */ STATIC void tryexec(char *, char **, char **); STATIC void printentry(struct tblentry *); -STATIC void clearcmdentry(int); +STATIC void clearcmdentry(void); STATIC struct tblentry *cmdlookup(const char *, int); STATIC void delete_cmd_entry(void); STATIC void addcmdentry(char *, struct cmdentry *); @@ -168,7 +168,27 @@ repeat: } } +static const char *legal_pathopt(const char *opt, const char *term, int magic) +{ + switch (magic) { + case 0: + opt = NULL; + break; + case 1: +...
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] command: allow combining -p with -v
...g.uk> --- usr/dash/exec.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/usr/dash/exec.c b/usr/dash/exec.c index 79e20074..e56e3f67 100644 --- a/usr/dash/exec.c +++ b/usr/dash/exec.c @@ -96,7 +96,7 @@ STATIC void clearcmdentry(int); STATIC struct tblentry *cmdlookup(const char *, int); STATIC void delete_cmd_entry(void); STATIC void addcmdentry(char *, struct cmdentry *); -STATIC int describe_command(struct output *, char *, int); +STATIC int describe_command(struct output *, char *, const char *, int); /* @@ -727,21 +727,21 @@ typecmd(int argc, char **...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] command: allow combining -p with -v
...g.uk> --- usr/dash/exec.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/usr/dash/exec.c b/usr/dash/exec.c index 79e20074..e56e3f67 100644 --- a/usr/dash/exec.c +++ b/usr/dash/exec.c @@ -96,7 +96,7 @@ STATIC void clearcmdentry(int); STATIC struct tblentry *cmdlookup(const char *, int); STATIC void delete_cmd_entry(void); STATIC void addcmdentry(char *, struct cmdentry *); -STATIC int describe_command(struct output *, char *, int); +STATIC int describe_command(struct output *, char *, const char *, int); /* @@ -727,21 +727,21 @@ typecmd(int argc, char **...
2020 Mar 28
0
[klibc:update-dash] dash: exec: Do not allocate stack string in padvance
...k(); idx++; if (pathopt) { if (prefix(pathopt, "builtin")) { @@ -398,7 +398,7 @@ loop: if (!S_ISREG(statb.st_mode)) continue; if (pathopt) { /* this is a %func directory */ - stalloc(strlen(fullname) + 1); + stalloc(len); readcmdfile(fullname); if ((cmdp = cmdlookup(name, 0)) == NULL || cmdp->cmdtype != CMDFUNCTION) @@ -789,9 +789,9 @@ describe_command(out, command, path, verbose) p = command; } else { do { - p = padvance(&path, command); - stunalloc(p); + padvance(&path, command); } while (--j >= 0); + p = stack...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Add assignment built-in support again
...ct cmdentry *entry, int act, const char *path) } updatetbl = (path == pathval()); - if (!updatetbl) { + if (!updatetbl) act |= DO_ALTPATH; - if (strstr(path, "%builtin") != NULL) - act |= DO_ALTBLTIN; - } /* If name is in the table, check answer will be ok */ if ((cmdp = cmdlookup(name, 0)) != NULL) { @@ -373,17 +370,20 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) abort(); #endif case CMDNORMAL: - bit = DO_ALTPATH; + bit = DO_ALTPATH | DO_REGBLTIN; break; case CMDFUNCTION: bit = DO_NOFUNC; break; case CMDBUILTIN...