From erik@smluc.org  Sun Mar 13 00:33:01 2005
Return-Path: <erik@smluc.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 4324016A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 13 Mar 2005 00:33:01 +0000 (GMT)
Received: from phoenix.smluc.org (phoenix.smluc.org [12.28.48.23])
	by mx1.FreeBSD.org (Postfix) with ESMTP id BE66C43D2D
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 13 Mar 2005 00:33:00 +0000 (GMT)
	(envelope-from erik@smluc.org)
Received: by phoenix.smluc.org (Postfix, from userid 1000)
	id 2E1AB1CE55; Sat, 12 Mar 2005 18:33:42 -0600 (CST)
Message-Id: <20050313003342.2E1AB1CE55@phoenix.smluc.org>
Date: Sat, 12 Mar 2005 18:33:42 -0600 (CST)
From: Erik Greenwald <erik@smluc.org>
Reply-To: Erik Greenwald <erik@smluc.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: erik@math.smsu.edu
Subject: patch: verbosity for bin/chflags
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         78759
>Category:       bin
>Synopsis:       patch: verbosity for bin/chflags
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 13 00:40:01 GMT 2005
>Closed-Date:    Fri Mar 02 01:26:35 GMT 2007
>Last-Modified:  Fri Mar 02 01:26:35 GMT 2007
>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@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:

From: Erik Greenwald <erik@smluc.org>
To: bug-followup@FreeBSD.org
Cc: erik@math.missouristate.edu
Subject: Re: bin/78759 : patch: verbosity for bin/chflags
Date: Fri, 2 Jun 2006 12:59:12 -0500

 There's a typo in the manpage part of the patch...
 +to be move verbose, printing the name of the files as their flags are modified.
 should read "to be more verbose"
 
         -Erik <erik@smluc.org> [http://math.missouristate.edu/~erik]
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Fri Mar 2 01:26:16 UTC 2007 
State-Changed-Why:  
Closed at submitter's request. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=78759 
>Unformatted:
