Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Mar 2009 17:20:43 +0000 (UTC)
From:      Stefan Farfeleder <stefanf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r190270 - head/bin/sh
Message-ID:  <200903221720.n2MHKhwB074759@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: stefanf
Date: Sun Mar 22 17:20:42 2009
New Revision: 190270
URL: http://svn.freebsd.org/changeset/base/190270

Log:
  Make the output of the alias built-in POSIX-compliant: Drop the leading 'alias'
  and suppress printing the trailing space which is added for internal purposes.

Modified:
  head/bin/sh/alias.c

Modified: head/bin/sh/alias.c
==============================================================================
--- head/bin/sh/alias.c	Sun Mar 22 17:09:56 2009	(r190269)
+++ head/bin/sh/alias.c	Sun Mar 22 17:20:42 2009	(r190270)
@@ -203,8 +203,13 @@ aliascmd(int argc, char **argv)
 		for (i = 0; i < ATABSIZE; i++)
 			for (ap = atab[i]; ap; ap = ap->next) {
 				if (*ap->name != '\0') {
-					out1fmt("alias %s=", ap->name);
+					out1fmt("%s=", ap->name);
+					/* Don't print the space added
+					 * above. */
+					v = ap->val + strlen(ap->val) - 1;
+					*v = '\0';
 					out1qstr(ap->val);
+					*v = ' ';
 					out1c('\n');
 				}
 			}



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