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)
This commit is contained in:
Johan Karlsson 2003-04-25 08:57:55 +00:00
parent a14744f268
commit ae29e30076
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114005
4 changed files with 44 additions and 6 deletions

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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)