svn commit: r255072 - in head: bin/sh tools/regression/bin/sh/builtins

Jilles Tjoelker jilles at FreeBSD.org
Fri Aug 30 12:10:00 UTC 2013


Author: jilles
Date: Fri Aug 30 12:09:59 2013
New Revision: 255072
URL: http://svnweb.freebsd.org/changeset/base/255072

Log:
  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.

Added:
  head/tools/regression/bin/sh/builtins/type3.0   (contents, props changed)
Modified:
  head/bin/sh/exec.c

Modified: head/bin/sh/exec.c
==============================================================================
--- head/bin/sh/exec.c	Fri Aug 30 11:42:57 2013	(r255071)
+++ head/bin/sh/exec.c	Fri Aug 30 12:09:59 2013	(r255072)
@@ -762,5 +762,7 @@ typecmd_impl(int argc, char **argv, int 
 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));
 }

Added: head/tools/regression/bin/sh/builtins/type3.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/type3.0	Fri Aug 30 12:09:59 2013	(r255072)
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+[ "$(type type)" = "$(type -- type)" ]


More information about the svn-src-all mailing list