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 LINKS= ${BINDIR}/chown /usr/bin/chgrp
MAN= chgrp.1 chown.8 MAN= chgrp.1 chown.8
WARNS?= 2 WARNS?= 5
.include <bsd.prog.mk> .include <bsd.prog.mk>

View File

@ -35,7 +35,7 @@
.\" @(#)chgrp.1 8.3 (Berkeley) 3/31/94 .\" @(#)chgrp.1 8.3 (Berkeley) 3/31/94
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd March 31, 1994 .Dd April 25, 2003
.Dt CHGRP 1 .Dt CHGRP 1
.Os .Os
.Sh NAME .Sh NAME
@ -88,6 +88,11 @@ rather than the file that is pointed to.
Cause Cause
.Nm .Nm
to be verbose, showing files as the group is modified. 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 .El
.Pp .Pp
The The

View File

@ -32,7 +32,7 @@
.\" @(#)chown.8 8.3 (Berkeley) 3/31/94 .\" @(#)chown.8 8.3 (Berkeley) 3/31/94
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd March 31, 1994 .Dd April 25, 2003
.Dt CHOWN 8 .Dt CHOWN 8
.Os .Os
.Sh NAME .Sh NAME
@ -96,6 +96,11 @@ group ID of the link itself.
Cause Cause
.Nm .Nm
to be verbose, showing files as the owner is modified. 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 .El
.Pp .Pp
The The

View File

@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include <grp.h> #include <grp.h>
#include <libgen.h> #include <libgen.h>
#include <pwd.h> #include <pwd.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -106,7 +107,7 @@ main(int argc, char **argv)
hflag = 1; hflag = 1;
break; break;
case 'v': case 'v':
vflag = 1; vflag++;
break; break;
case '?': case '?':
default: default:
@ -191,8 +192,35 @@ main(int argc, char **argv)
rval = 1; rval = 1;
} }
} else { } else {
if (vflag) if (vflag) {
printf("%s\n", p->fts_path); 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) if (errno)