bin/78759: patch: verbosity for bin/chflags
Erik Greenwald
erik at smluc.org
Sat Mar 12 16:40:02 PST 2005
>Number: 78759
>Category: bin
>Synopsis: patch: verbosity for bin/chflags
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sun Mar 13 00:40:01 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Erik Greenwald
>Release: FreeBSD 5.3-RELEASE-p2 i386
>Organization:
>Environment:
FreeBSD vidar.br0kenland.org 6.0-CURRENT FreeBSD 6.0-CURRENT #9: Sun Mar 6 12:38:06 EST 2005 root at vidar.br0kenland.org:/usr/obj/usr/src/sys/VIDAR i386
>Description:
this patch adds a -v option to bin/chflags. 2+ -v's will also print
the "flags" variable (the names, like, say, "schg nodump" after the
file name... it may be better to map out the actual changes and
print those? *shrug*
Man page and programs help have been updated to reflect.
>How-To-Repeat:
>Fix:
--- bin_chflags.patch begins here ---
Index: bin/chflags/chflags.1
===================================================================
RCS file: /home/ncvs/src/bin/chflags/chflags.1,v
retrieving revision 1.23
diff -u -r1.23 chflags.1
--- bin/chflags/chflags.1 25 Feb 2005 00:40:46 -0000 1.23
+++ bin/chflags/chflags.1 13 Mar 2005 00:28:55 -0000
@@ -40,6 +40,7 @@
.Nd change file flags
.Sh SYNOPSIS
.Nm
+.Op Fl v
.Oo
.Fl R
.Op Fl H | Fl L | Fl P
@@ -73,6 +74,11 @@
.It Fl R
Change the file flags for the file hierarchies rooted
in the files instead of just the files themselves.
+.It Fl v
+Cause
+.Nm
+to be move verbose, printing the name of the files as their flags are modified.
+If specified more than once, the flags applied are printed as well.
.El
.Pp
The flags are specified as an octal number or a comma separated list
Index: bin/chflags/chflags.c
===================================================================
RCS file: /home/ncvs/src/bin/chflags/chflags.c,v
retrieving revision 1.22
diff -u -r1.22 chflags.c
--- bin/chflags/chflags.c 10 Jan 2005 08:39:20 -0000 1.22
+++ bin/chflags/chflags.c 13 Mar 2005 00:28:55 -0000
@@ -62,11 +62,11 @@
FTSENT *p;
u_long clear, set;
long val;
- int Hflag, Lflag, Rflag, ch, fts_options, oct, rval;
+ int Hflag, Lflag, Rflag, ch, fts_options, oct, rval, vflag;
char *flags, *ep;
- Hflag = Lflag = Rflag = 0;
- while ((ch = getopt(argc, argv, "HLPR")) != -1)
+ Hflag = Lflag = Rflag = vflag = 0;
+ while ((ch = getopt(argc, argv, "HLPRv")) != -1)
switch (ch) {
case 'H':
Hflag = 1;
@@ -82,6 +82,9 @@
case 'R':
Rflag = 1;
break;
+ case 'v':
+ vflag++;
+ break;
case '?':
default:
usage();
@@ -151,6 +154,17 @@
default:
break;
}
+
+ if (vflag) {
+ (void)printf("%s", p->fts_path);
+ /*
+ * Perhaps this should print the previous flags as well?
+ */
+ if (vflag > 1)
+ (void)printf(": %s", flags);
+ (void)printf("\n");
+ }
+
if (oct) {
if (!chflags(p->fts_accpath, set))
continue;
@@ -172,6 +186,6 @@
usage(void)
{
(void)fprintf(stderr,
- "usage: chflags [-R [-H | -L | -P]] flags file ...\n");
+ "usage: chflags [-v] [-R [-H | -L | -P]] flags file ...\n");
exit(1);
}
--- bin_chflags.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list