summaryrefslogtreecommitdiffstats
path: root/usr.sbin/chown
diff options
context:
space:
mode:
authorjohan <johan@FreeBSD.org>2003-04-25 08:57:55 +0000
committerjohan <johan@FreeBSD.org>2003-04-25 08:57:55 +0000
commitb15a9b8776135db9c5788b9625ab112909dbc343 (patch)
tree70687a8298d3f7b38c8d2af984bfc34260f37707 /usr.sbin/chown
parentf519d72bc973c8a03c8dcd6bbef9dbf1f3da3387 (diff)
downloadFreeBSD-src-b15a9b8776135db9c5788b9625ab112909dbc343.zip
FreeBSD-src-b15a9b8776135db9c5788b9625ab112909dbc343.tar.gz
Similar to chmod(1); make -v -v mean very verbose and show
the old and new uid/gid. PR: 41341 Submitted by: Edward Brocklesby <nighthawk@unrealircd.com> Reviewed by: bde@ (an older version)
Diffstat (limited to 'usr.sbin/chown')
-rw-r--r--usr.sbin/chown/Makefile2
-rw-r--r--usr.sbin/chown/chgrp.17
-rw-r--r--usr.sbin/chown/chown.87
-rw-r--r--usr.sbin/chown/chown.c34
4 files changed, 44 insertions, 6 deletions
diff --git a/usr.sbin/chown/Makefile b/usr.sbin/chown/Makefile
index 017ed61..63c5a22 100644
--- a/usr.sbin/chown/Makefile
+++ b/usr.sbin/chown/Makefile
@@ -5,6 +5,6 @@ PROG= chown
LINKS= ${BINDIR}/chown /usr/bin/chgrp
MAN= chgrp.1 chown.8
-WARNS?= 2
+WARNS?= 5
.include <bsd.prog.mk>
diff --git a/usr.sbin/chown/chgrp.1 b/usr.sbin/chown/chgrp.1
index b52f7e5..c8d6d5f 100644
--- a/usr.sbin/chown/chgrp.1
+++ b/usr.sbin/chown/chgrp.1
@@ -35,7 +35,7 @@
.\" @(#)chgrp.1 8.3 (Berkeley) 3/31/94
.\" $FreeBSD$
.\"
-.Dd March 31, 1994
+.Dd April 25, 2003
.Dt CHGRP 1
.Os
.Sh NAME
@@ -88,6 +88,11 @@ rather than the file that is pointed to.
Cause
.Nm
to be verbose, showing files as the group is modified.
+If the
+.Fl v
+flag is specified more than once,
+.Nm
+will print the filename, followed by the old and new numeric group ID.
.El
.Pp
The
diff --git a/usr.sbin/chown/chown.8 b/usr.sbin/chown/chown.8
index 364ac88..c7718b6 100644
--- a/usr.sbin/chown/chown.8
+++ b/usr.sbin/chown/chown.8
@@ -32,7 +32,7 @@
.\" @(#)chown.8 8.3 (Berkeley) 3/31/94
.\" $FreeBSD$
.\"
-.Dd March 31, 1994
+.Dd April 25, 2003
.Dt CHOWN 8
.Os
.Sh NAME
@@ -96,6 +96,11 @@ group ID of the link itself.
Cause
.Nm
to be verbose, showing files as the owner is modified.
+If the
+.Fl v
+flag is specified more than once,
+.Nm
+will print the filename, followed by the old and new numeric user/group ID.
.El
.Pp
The
diff --git a/usr.sbin/chown/chown.c b/usr.sbin/chown/chown.c
index d737bdb..cf7cb50 100644
--- a/usr.sbin/chown/chown.c
+++ b/usr.sbin/chown/chown.c
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include <grp.h>
#include <libgen.h>
#include <pwd.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -106,7 +107,7 @@ main(int argc, char **argv)
hflag = 1;
break;
case 'v':
- vflag = 1;
+ vflag++;
break;
case '?':
default:
@@ -191,8 +192,35 @@ main(int argc, char **argv)
rval = 1;
}
} else {
- if (vflag)
- printf("%s\n", p->fts_path);
+ if (vflag) {
+ printf("%s", p->fts_path);
+ if (vflag > 1) {
+ if (ischown) {
+ printf(": %ju:%ju -> %ju:%ju",
+ (uintmax_t)
+ p->fts_statp->st_uid,
+ (uintmax_t)
+ p->fts_statp->st_gid,
+ (uid == (uid_t)-1) ?
+ (uintmax_t)
+ p->fts_statp->st_uid :
+ (uintmax_t)uid,
+ (gid == (gid_t)-1) ?
+ (uintmax_t)
+ p->fts_statp->st_gid :
+ (uintmax_t)gid);
+ } else {
+ printf(": %ju -> %ju",
+ (uintmax_t)
+ p->fts_statp->st_gid,
+ (gid == (gid_t)-1) ?
+ (uintmax_t)
+ p->fts_statp->st_gid :
+ (uintmax_t)gid);
+ }
+ }
+ printf("\n");
+ }
}
}
if (errno)
OpenPOWER on IntegriCloud