Subject: While I am at it chown.diff
To: None <tech-userlevel@netbsd.org>
From: Jason R. Fink <jrf@adresearch.com>
List: tech-userlevel
Date: 01/08/2003 14:20:55
--TB36FDmn/VVEgNH/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello Aaaagain,

Someone alerted me to the fact that FreeBSD also has a verbose
option for chown/chgrp and chmod. The chown/chgrp one is 
trivial so I went ahead and did it real quick. The chmod one
will take a little time.

Anyhow, see attached diff.

	j

-- 
J Fink http://pyxis.homeunix.net/~jrf/
NetBSD Developer http://www.netbsd.org/
Senior Sysadmin/Programmer http://www.ipsos.com/

--TB36FDmn/VVEgNH/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="chown.diff"

Index: chgrp.1
===================================================================
RCS file: /cvsroot/src/usr.sbin/chown/chgrp.1,v
retrieving revision 1.13
diff -u -r1.13 chgrp.1
--- chgrp.1	2002/02/08 01:38:47	1.13
+++ chgrp.1	2003/01/08 19:18:04
@@ -35,7 +35,7 @@
 .\"     from: @(#)chgrp.1	8.3 (Berkeley) 3/31/94
 .\"	$NetBSD: chgrp.1,v 1.13 2002/02/08 01:38:47 ross Exp $
 .\"
-.Dd March 31, 1994
+.Dd January 8, 2003
 .Dt CHGRP 1
 .Os
 .Sh NAME
@@ -47,7 +47,7 @@
 .Fl R
 .Op Fl H | Fl L | Fl P
 .Oc
-.Op Fl fh
+.Op Fl fhv
 .Ar group
 .Ar files ...
 .Sh DESCRIPTION
@@ -84,6 +84,10 @@
 If
 .Ar file
 is a symbolic link, the group of the link is changed.
+.It Fl v
+Cause
+.Nm
+to be verbose, showing files as they are processed.
 .El
 .Pp
 If
@@ -144,3 +148,8 @@
 The
 .Nm
 utility is expected to be POSIX 1003.2 compatible.
+.Pp
+The
+.Fl v
+option is an extension to 
+.St -p1003.2 .
Index: chown.8
===================================================================
RCS file: /cvsroot/src/usr.sbin/chown/chown.8,v
retrieving revision 1.14
diff -u -r1.14 chown.8
--- chown.8	2002/02/08 01:38:47	1.14
+++ chown.8	2003/01/08 19:18:04
@@ -32,7 +32,7 @@
 .\"     from: @(#)chown.8	8.3 (Berkeley) 3/31/94
 .\"	$NetBSD: chown.8,v 1.14 2002/02/08 01:38:47 ross Exp $
 .\"
-.Dd March 31, 1994
+.Dd January 8, 2003
 .Dt CHOWN 8
 .Os
 .Sh NAME
@@ -44,7 +44,7 @@
 .Fl R
 .Op Fl H | Fl L | Fl P
 .Oc
-.Op Fl fh
+.Op Fl fhv
 .Ar owner Ns Op Ar :group
 .Ar file ...
 .Nm ""
@@ -52,7 +52,7 @@
 .Fl R
 .Op Fl H | Fl L | Fl P
 .Oc
-.Op Fl fh
+.Op Fl fhv
 .Ar :group
 .Ar file ...
 .Sh DESCRIPTION
@@ -84,6 +84,10 @@
 If
 .Ar file
 is a symbolic link, the owner and/or group of the link is changed.
+.It Fl v
+Cause
+.Nm 
+to be verbose, showing files as they are processed.
 .El
 .Pp
 The
@@ -152,3 +156,8 @@
 The
 .Nm
 command is expected to be POSIX 1003.2 compliant.
+.Pp
+The
+.Fl v
+option is an extension to 
+.St -p1003.2 .
Index: chown.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/chown/chown.c,v
retrieving revision 1.26
diff -u -r1.26 chown.c
--- chown.c	2002/07/07 11:44:03	1.26
+++ chown.c	2003/01/08 19:18:04
@@ -81,7 +81,7 @@
 {
 	FTS *ftsp;
 	FTSENT *p;
-	int Hflag, Lflag, Rflag, ch, fflag, fts_options, hflag, rval;
+	int Hflag, Lflag, Rflag, ch, fflag, fts_options, hflag, rval, vflag;
 	char *cp;
 	int (*change_owner) __P((const char *, uid_t, gid_t));
 
@@ -90,8 +90,8 @@
 	myname = (cp = strrchr(*argv, '/')) ? cp + 1 : *argv;
 	ischown = (myname[2] == 'o');
 
-	Hflag = Lflag = Rflag = fflag = hflag = 0;
-	while ((ch = getopt(argc, argv, "HLPRfh")) != -1)
+	Hflag = Lflag = Rflag = fflag = hflag = vflag = 0;
+	while ((ch = getopt(argc, argv, "HLPRfhv")) != -1)
 		switch (ch) {
 		case 'H':
 			Hflag = 1;
@@ -120,6 +120,9 @@
 			 */
 			hflag = 1;
 			break;
+		case 'v':
+			vflag = 1;
+			break;
 		case '?':
 		default:
 			usage();
@@ -213,6 +216,9 @@
 		if ((*change_owner)(p->fts_accpath, uid, gid) && !fflag) {
 			warn("%s", p->fts_path);
 			rval = EXIT_FAILURE;
+		} else {
+			if (vflag)
+				printf("%s\n", p->fts_path);
 		}
 	}
 	if (errno)
@@ -270,7 +276,7 @@
 {
 
 	(void)fprintf(stderr,
-	    "usage: %s [-R [-H | -L | -P]] [-fh] %s file ...\n",
+	    "usage: %s [-R [-H | -L | -P]] [-fhv] %s file ...\n",
 	    myname, ischown ? "[owner][:group]" : "group");
 	exit(EXIT_FAILURE);
 }

--TB36FDmn/VVEgNH/--