svn commit: r190270 - head/bin/sh

Stefan Farfeleder stefanf at FreeBSD.org
Sun Mar 22 10:20:46 PDT 2009


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


More information about the svn-src-all mailing list