Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Aug 2013 11:42:53 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254849 - in head: bin/sh tools/regression/bin/sh/builtins
Message-ID:  <201308251142.r7PBgrG2044454@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sun Aug 25 11:42:53 2013
New Revision: 254849
URL: http://svnweb.freebsd.org/changeset/base/254849

Log:
  sh: Recognize "--" as end of options in alias builtin.
  
  Aliases starting with "-" (which are non-POSIX) will need to be preceded by
  an alias not starting with "-" or the newly added "--".

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

Modified: head/bin/sh/alias.c
==============================================================================
--- head/bin/sh/alias.c	Sun Aug 25 11:34:37 2013	(r254848)
+++ head/bin/sh/alias.c	Sun Aug 25 11:42:53 2013	(r254849)
@@ -237,17 +237,19 @@ printaliases(void)
 }
 
 int
-aliascmd(int argc, char **argv)
+aliascmd(int argc __unused, char **argv __unused)
 {
 	char *n, *v;
 	int ret = 0;
 	struct alias *ap;
 
-	if (argc == 1) {
+	nextopt("");
+
+	if (*argptr == NULL) {
 		printaliases();
 		return (0);
 	}
-	while ((n = *++argv) != NULL) {
+	while ((n = *argptr++) != NULL) {
 		if ((v = strchr(n+1, '=')) == NULL) /* n+1: funny ksh stuff */
 			if ((ap = lookupalias(n, 0)) == NULL) {
 				warning("%s: not found", n);

Added: head/tools/regression/bin/sh/builtins/alias4.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/alias4.0	Sun Aug 25 11:42:53 2013	(r254849)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+unalias -a
+alias --



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308251142.r7PBgrG2044454>