Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/rm PR/47770: Eitan Adler: add x flag to rm to avoid cros...
details: https://anonhg.NetBSD.org/src/rev/4b7c3058c927
branches: trunk
changeset: 786335:4b7c3058c927
user: christos <christos%NetBSD.org@localhost>
date: Fri Apr 26 18:43:22 2013 +0000
description:
PR/47770: Eitan Adler: add x flag to rm to avoid cross mount points
diffstat:
bin/rm/rm.1 | 12 ++++++++----
bin/rm/rm.c | 16 +++++++++++-----
2 files changed, 19 insertions(+), 9 deletions(-)
diffs (112 lines):
diff -r 2ca7b23fe58c -r 4b7c3058c927 bin/rm/rm.1
--- a/bin/rm/rm.1 Fri Apr 26 18:35:43 2013 +0000
+++ b/bin/rm/rm.1 Fri Apr 26 18:43:22 2013 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: rm.1,v 1.25 2012/10/13 14:18:16 njoly Exp $
+.\" $NetBSD: rm.1,v 1.26 2013/04/26 18:43:22 christos Exp $
.\"
.\" Copyright (c) 1990, 1993, 1994, 2003
.\" The Regents of the University of California. All rights reserved.
@@ -32,7 +32,7 @@
.\"
.\" @(#)rm.1 8.5 (Berkeley) 12/5/94
.\"
-.Dd August 25, 2006
+.Dd April 26, 2013
.Dt RM 1
.Os
.Sh NAME
@@ -41,7 +41,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl f | Fl i
-.Op Fl dPRrvW
+.Op Fl dPRrvWx
.Ar
.Sh DESCRIPTION
The
@@ -110,6 +110,8 @@
Attempts to undelete the named files.
Currently, this option can only be used to recover
files covered by whiteouts.
+.It Fl x
+When removing a hierarchy, do not cross mount points.
.El
.Pp
The
@@ -189,7 +191,9 @@
compatible.
The
.Fl v
-option is an extension.
+and
+.Fl x
+options are extensions.
.Pp
The
.Fl P
diff -r 2ca7b23fe58c -r 4b7c3058c927 bin/rm/rm.c
--- a/bin/rm/rm.c Fri Apr 26 18:35:43 2013 +0000
+++ b/bin/rm/rm.c Fri Apr 26 18:43:22 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rm.c,v 1.52 2012/06/13 07:35:37 dholland Exp $ */
+/* $NetBSD: rm.c,v 1.53 2013/04/26 18:43:22 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994, 2003
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)rm.c 8.8 (Berkeley) 4/27/95";
#else
-__RCSID("$NetBSD: rm.c,v 1.52 2012/06/13 07:35:37 dholland Exp $");
+__RCSID("$NetBSD: rm.c,v 1.53 2013/04/26 18:43:22 christos Exp $");
#endif
#endif /* not lint */
@@ -61,6 +61,7 @@
#include <unistd.h>
static int dflag, eval, fflag, iflag, Pflag, stdin_ok, vflag, Wflag;
+static int xflag;
static sig_atomic_t pinfo;
static int check(char *, char *, struct stat *);
@@ -94,8 +95,8 @@
setprogname(argv[0]);
(void)setlocale(LC_ALL, "");
- Pflag = rflag = 0;
- while ((ch = getopt(argc, argv, "dfiPRrvW")) != -1)
+ Pflag = rflag = xflag = 0;
+ while ((ch = getopt(argc, argv, "dfiPRrvWx")) != -1)
switch (ch) {
case 'd':
dflag = 1;
@@ -118,6 +119,9 @@
case 'v':
vflag = 1;
break;
+ case 'x':
+ xflag = 1;
+ break;
case 'W':
Wflag = 1;
break;
@@ -175,6 +179,8 @@
flags |= FTS_NOSTAT;
if (Wflag)
flags |= FTS_WHITEOUT;
+ if (xflag)
+ flags |= FTS_XDEV;
if ((fts = fts_open(argv, flags, NULL)) == NULL)
err(1, "fts_open failed");
while ((p = fts_read(fts)) != NULL) {
@@ -591,7 +597,7 @@
usage(void)
{
- (void)fprintf(stderr, "usage: %s [-f|-i] [-dPRrvW] file ...\n",
+ (void)fprintf(stderr, "usage: %s [-f|-i] [-dPRrvWx] file ...\n",
getprogname());
exit(1);
/* NOTREACHED */
Home |
Main Index |
Thread Index |
Old Index