summaryrefslogtreecommitdiff
path: root/bin/sh/exec.c
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2016-01-03 21:30:22 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2016-01-03 21:30:22 +0000
commitd3fa2c78f2dc0f2638feab6e7c2c5263f42b5440 (patch)
tree21c43e175ed25cae61d18bdd8bbe0943c006e5de /bin/sh/exec.c
parentd3e4bc1271f6d0df1dc6e728826c4c6423fbd2e5 (diff)
downloadsrc-test2-d3fa2c78f2dc0f2638feab6e7c2c5263f42b5440.tar.gz
src-test2-d3fa2c78f2dc0f2638feab6e7c2c5263f42b5440.zip
Notes
Diffstat (limited to 'bin/sh/exec.c')
-rw-r--r--bin/sh/exec.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/sh/exec.c b/bin/sh/exec.c
index 7d18c3cfc62d..ab86b7639c9a 100644
--- a/bin/sh/exec.c
+++ b/bin/sh/exec.c
@@ -439,12 +439,14 @@ success:
int
find_builtin(const char *name, int *special)
{
- const struct builtincmd *bp;
+ const unsigned char *bp;
+ size_t len;
- for (bp = builtincmd ; bp->name ; bp++) {
- if (*bp->name == *name && equal(bp->name, name)) {
- *special = bp->special;
- return bp->code;
+ len = strlen(name);
+ for (bp = builtincmd ; *bp ; bp += 2 + bp[0]) {
+ if (bp[0] == len && memcmp(bp + 2, name, len) == 0) {
+ *special = (bp[1] & BUILTIN_SPECIAL) != 0;
+ return bp[1] & ~BUILTIN_SPECIAL;
}
}
return -1;