Add "-v".

This commit is contained in:
David E. O'Brien 1999-11-27 19:25:08 +00:00
parent c628363b98
commit 5bb83b98db
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53780
5 changed files with 47 additions and 6 deletions

View File

@ -47,6 +47,7 @@
.Fl f
.Fl R
.Op Fl H | Fl L | Fl P
.Fl v
.Oc
.Ar mode
.Ar file ...
@ -80,6 +81,10 @@ instead of just the files themselves.
Do not display a diagnostic message if
.Nm
could not modify the mode for
.It Fl v
Cause
.Nm
to be verbose, showing files as the mode is modified.
.Va file .
.El
.Pp
@ -307,6 +312,10 @@ set the group bits equal to the user bits, but clear the group write bit.
There's no
.Ar perm
option for the naughty bits.
.Sh COMPATIBILITY
The
.Fl v
option is non-standard and its use in scripts is not recommended.
.Sh SEE ALSO
.Xr chflags 1 ,
.Xr install 1 ,

View File

@ -70,12 +70,13 @@ main(argc, argv)
long val;
int oct, omode;
int Hflag, Lflag, Pflag, Rflag, ch, fflag, fts_options, hflag, rval;
int vflag;
char *ep, *mode;
set = NULL;
omode = 0;
Hflag = Lflag = Pflag = Rflag = fflag = hflag = 0;
while ((ch = getopt(argc, argv, "HLPRXfgorstuwx")) != -1)
while ((ch = getopt(argc, argv, "HLPRXfgorstuvwx")) != -1)
switch (ch) {
case 'H':
Hflag = 1;
@ -118,6 +119,9 @@ main(argc, argv)
argv[optind - 1][2] == '\0')
--optind;
goto done;
case 'v':
vflag = 1;
break;
case '?':
default:
usage();
@ -191,6 +195,9 @@ done: argv += optind;
getmode(set, p->fts_statp->st_mode)) && !fflag) {
warn(p->fts_path);
rval = 1;
} else {
if (vflag)
(void)printf("%s\n", p->fts_accpath);
}
}
if (errno)
@ -203,6 +210,6 @@ void
usage()
{
(void)fprintf(stderr,
"usage: chmod [-f -R [-H | -L | -P]] mode file ...\n");
"usage: chmod [-f -R [-H | -L | -P] -v] mode file ...\n");
exit(1);
}

View File

@ -49,6 +49,7 @@
.Oc
.Op Fl f
.Op Fl h
.Op Fl v
.Ar group
.Ar
.Sh DESCRIPTION
@ -84,6 +85,10 @@ query about strange modes (unless the user does not have proper permissions).
.It Fl h
If the file is a symbolic link, the group ID of the link itself is changed
rather than the file that is pointed to.
.It Fl v
Cause
.Nm
to be verbose, showing files as the group is modified.
.El
.Pp
The
@ -114,6 +119,10 @@ The
utility exits 0 on success, and >0 if an error occurs.
.Sh COMPATIBILITY
In previous versions of this system, symbolic links did not have groups.
.Pp
The
.Fl v
option is non-standard and its use in scripts is not recommended.
.Sh FILES
.Bl -tag -width /etc/group -compact
.It Pa /etc/group

View File

@ -46,6 +46,7 @@
.Oc
.Op Fl f
.Op Fl h
.Op Fl v
.Ar owner Ns Op Ar :group
.Ar file ...
.Nm chown
@ -55,6 +56,7 @@
.Oc
.Op Fl f
.Op Fl h
.Op Fl v
.Ar :group
.Ar
.Sh DESCRIPTION
@ -85,6 +87,10 @@ the exit status to reflect such failures.
.It Fl h
If the file is a symbolic link, change the user ID and/or the group ID
of the link itself rather than the file that the link points to.
.It Fl v
Cause
.Nm
to be verbose, showing files as the owner is modified.
.El
.Pp
The
@ -133,6 +139,10 @@ group names may contain the dot character.
.Pp
On previous versions of this system, symbolic links did not have
owners.
.Pp
The
.Fl v
option is non-standard and its use in scripts is not recommended.
.Sh SEE ALSO
.Xr chgrp 1 ,
.Xr find 1 ,

View File

@ -69,7 +69,7 @@ void usage __P((void));
uid_t uid;
gid_t gid;
int Rflag, ischown, fflag, hflag;
int Rflag, ischown, fflag, hflag, vflag;
char *gname, *myname;
int
@ -183,11 +183,17 @@ main(argc, argv)
if (lchown(p->fts_accpath, uid, gid) && !fflag) {
chownerr(p->fts_path);
rval = 1;
} else {
if (vflag)
(void)printf("%s\n", p->fts_accpath);
}
} else {
if (chown(p->fts_accpath, uid, gid) && !fflag) {
chownerr(p->fts_path);
rval = 1;
} else {
if (vflag)
(void)printf("%s\n", p->fts_accpath);
}
}
}
@ -266,8 +272,8 @@ void
usage()
{
(void)fprintf(stderr, "%s\n%s\n%s\n",
"usage: chown [-R [-H | -L | -P]] [-f] [-h] owner[:group] file ...",
" chown [-R [-H | -L | -P]] [-f] [-h] :group file ...",
" chgrp [-R [-H | -L | -P]] [-f] [-h] group file ...");
"usage: chown [-R [-H | -L | -P]] [-f] [-h] [-v] owner[:group] file ...",
" chown [-R [-H | -L | -P]] [-f] [-h] [-v] :group file ...",
" chgrp [-R [-H | -L | -P]] [-f] [-h] [-v] group file ...");
exit(1);
}