summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-08-30 12:09:59 +0000
committerjilles <jilles@FreeBSD.org>2013-08-30 12:09:59 +0000
commit8b7d6031e6e1457ba0eb1e4ac04ad72adcb7c2ee (patch)
treeb23efef6513a6a367069a13eb80f2c1f48c0dec0 /bin/sh
parent0030cdac07df412f040b7616431b47c1265e0e69 (diff)
downloadFreeBSD-src-8b7d6031e6e1457ba0eb1e4ac04ad72adcb7c2ee.zip
FreeBSD-src-8b7d6031e6e1457ba0eb1e4ac04ad72adcb7c2ee.tar.gz
sh: Recognize "--" as end of options in type builtin.
This implementation makes minimal changes: command names starting with "-" (other than "--") can still be queried normally.
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/exec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/sh/exec.c b/bin/sh/exec.c
index 5f78de9..9f8e029 100644
--- a/bin/sh/exec.c
+++ b/bin/sh/exec.c
@@ -762,5 +762,7 @@ typecmd_impl(int argc, char **argv, int cmd, const char *path)
int
typecmd(int argc, char **argv)
{
+ if (argc > 2 && strcmp(argv[1], "--") == 0)
+ argc--, argv++;
return typecmd_impl(argc, argv, TYPECMD_TYPE, bltinlookup("PATH", 1));
}
OpenPOWER on IntegriCloud