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.
This commit is contained in:
Jilles Tjoelker 2013-08-30 12:09:59 +00:00
parent 8d99b9cebd
commit 65519ccb4d
2 changed files with 5 additions and 0 deletions

View file

@ -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));
}

View file

@ -0,0 +1,3 @@
# $FreeBSD$
[ "$(type type)" = "$(type -- type)" ]