usr/src/cmd/ls/ls.c
changeset 1420 4cb3c26a37e0
parent 789 b348f31ed315
child 1447 4b37e9d491a0
--- a/usr/src/cmd/ls/ls.c	Mon Feb 13 02:31:44 2006 -0800
+++ b/usr/src/cmd/ls/ls.c	Mon Feb 13 08:52:39 2006 -0800
@@ -20,7 +20,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -221,6 +221,7 @@
 static int		Rflg;
 static int		Sflg;
 static int		vflg;
+static int		Vflg;
 static long		hscale;
 static mode_t		flags;
 static int		err = 0;	/* Contains return code */
@@ -287,7 +288,7 @@
 	}
 
 	while ((c = getopt(argc, argv,
-	    "aAbcCdeEfFghHilLmnopqrRsStux1@v")) != EOF)
+	    "aAbcCdeEfFghHilLmnopqrRsStux1@vV")) != EOF)
 		switch (c) {
 		case 'a':
 			aflg++;
@@ -416,6 +417,9 @@
 			cflg = 0;
 			uflg++;
 			continue;
+		case 'V':
+			Vflg++;
+			/*FALLTHROUGH*/
 		case 'v':
 			vflg++;
 #if !defined(XPG4)
@@ -460,7 +464,7 @@
 		}
 	if (opterr) {
 		(void) fprintf(stderr, gettext(
-		    "usage: ls -aAbcCdeEfFghHilLmnopqrRsStuxv1@ [files]\n"));
+		    "usage: ls -aAbcCdeEfFghHilLmnopqrRsStuxvV1@ [files]\n"));
 		exit(2);
 	}
 
@@ -868,7 +872,7 @@
 	if (vflg) {
 		new_line();
 		if (p->aclp) {
-			acl_printacl(p->aclp, num_cols);
+			acl_printacl(p->aclp, num_cols, Vflg);
 		}
 	}
 }
@@ -1378,6 +1382,11 @@
 				}
 			}
 
+			if (!vflg && !Vflg && rep->aclp) {
+				acl_free(rep->aclp);
+				rep->aclp = NULL;
+			}
+
 			if (atflg && pathconf(file, _PC_XATTR_EXISTS) == 1)
 				rep->acl = '@';
 		} else