aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Karlsson <johan@FreeBSD.org>2003-04-25 08:57:55 +0000
committerJohan Karlsson <johan@FreeBSD.org>2003-04-25 08:57:55 +0000
commitae29e30076cd8807e15927bd7f32724964c1b862 (patch)
tree70687a8298d3f7b38c8d2af984bfc34260f37707
parenta14744f2685ede9f1da78b70afd62c3f68d2147b (diff)
Notes
-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 017ed610a937..63c5a22f05da 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 b52f7e557a43..c8d6d5ff7751 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 364ac883f050..c7718b6dcde6 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 d737bdb226d9..cf7cb50ca4f5 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)