Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Mar 2018 01:56:07 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r330436 - head/bin/chflags
Message-ID:  <201803050156.w251u7Y8020941@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Mon Mar  5 01:56:07 2018
New Revision: 330436
URL: https://svnweb.freebsd.org/changeset/base/330436

Log:
  chflags: Add -x option to not traverse mount points.
  
  MFC after:	2 weeks

Modified:
  head/bin/chflags/chflags.1
  head/bin/chflags/chflags.c

Modified: head/bin/chflags/chflags.1
==============================================================================
--- head/bin/chflags/chflags.1	Mon Mar  5 01:18:32 2018	(r330435)
+++ head/bin/chflags/chflags.1	Mon Mar  5 01:56:07 2018	(r330436)
@@ -32,7 +32,7 @@
 .\"	@(#)chflags.1	8.4 (Berkeley) 5/2/95
 .\" $FreeBSD$
 .\"
-.Dd April 20, 2015
+.Dd March 4, 2018
 .Dt CHFLAGS 1
 .Os
 .Sh NAME
@@ -40,7 +40,7 @@
 .Nd change file flags
 .Sh SYNOPSIS
 .Nm
-.Op Fl fhv
+.Op Fl fhvx
 .Oo
 .Fl R
 .Op Fl H | Fl L | Fl P
@@ -98,6 +98,8 @@ If the
 .Fl v
 option is specified more than once, the old and new flags of the file
 will also be printed, in octal notation.
+.It Fl x
+Do not cross mount points.
 .El
 .Pp
 The flags are specified as an octal number or a comma separated list

Modified: head/bin/chflags/chflags.c
==============================================================================
--- head/bin/chflags/chflags.c	Mon Mar  5 01:18:32 2018	(r330435)
+++ head/bin/chflags/chflags.c	Mon Mar  5 01:56:07 2018	(r330436)
@@ -65,12 +65,12 @@ main(int argc, char *argv[])
 	FTSENT *p;
 	u_long clear, newflags, set;
 	long val;
-	int Hflag, Lflag, Rflag, fflag, hflag, vflag;
+	int Hflag, Lflag, Rflag, fflag, hflag, vflag, xflag;
 	int ch, fts_options, oct, rval;
 	char *flags, *ep;
 
-	Hflag = Lflag = Rflag = fflag = hflag = vflag = 0;
-	while ((ch = getopt(argc, argv, "HLPRfhv")) != -1)
+	Hflag = Lflag = Rflag = fflag = hflag = vflag = xflag = 0;
+	while ((ch = getopt(argc, argv, "HLPRfhvx")) != -1)
 		switch (ch) {
 		case 'H':
 			Hflag = 1;
@@ -95,6 +95,9 @@ main(int argc, char *argv[])
 		case 'v':
 			vflag++;
 			break;
+		case 'x':
+			xflag = 1;
+			break;
 		case '?':
 		default:
 			usage();
@@ -123,6 +126,8 @@ main(int argc, char *argv[])
 	} else {
 		fts_options = FTS_LOGICAL;
 	}
+	if (xflag)
+		fts_options |= FTS_XDEV;
 
 	flags = *argv;
 	if (*flags >= '0' && *flags <= '7') {
@@ -201,6 +206,6 @@ static void
 usage(void)
 {
 	(void)fprintf(stderr,
-	    "usage: chflags [-fhv] [-R [-H | -L | -P]] flags file ...\n");
+	    "usage: chflags [-fhvx] [-R [-H | -L | -P]] flags file ...\n");
 	exit(1);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803050156.w251u7Y8020941>