rm.patch

jorisgio, 04/13/2013 07:13 AM

Download (1.51 KB)

View differences:

bin/rm/rm.1
114 114
.It Fl r
115 115
Equivalent to
116 116
.Fl R .
117
.It Fl x
118
When removing a hierarchy, don't cross mount points.
117 119
.It Fl v
118 120
Be verbose when deleting files, showing them as they are removed.
119 121
.It Fl W
bin/rm/rm.c
54 54
#include <unistd.h>
55 55

  
56 56
static int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok;
57
static int rflag, Iflag;
57
static int rflag, Iflag, xflag;
58 58
static uid_t uid;
59 59
volatile sig_atomic_t info;
60 60

  
......
101 101
		exit(eval);
102 102
	}
103 103

  
104
	Pflag = rflag = 0;
105
	while ((ch = getopt(argc, argv, "dfiIPRrvW")) != -1) {
104
	Pflag = rflag = xflag = 0;
105
	while ((ch = getopt(argc, argv, "dfiIPRrvWx")) != -1) {
106 106
		switch(ch) {
107 107
		case 'd':
108 108
			dflag = 1;
......
139 139
		case 'W':
140 140
			Wflag = 1;
141 141
			break;
142
		case 'x':
143
			xflag = 1;
144
			break;
142 145
		default:
143 146
			usage();
144 147
		}
......
199 202
		flags |= FTS_NOSTAT;
200 203
	if (Wflag)
201 204
		flags |= FTS_WHITEOUT;
205
	if (xflag)
206
		flags |= FTS_XDEV;
202 207
	if ((fts = fts_open(argv, flags, NULL)) == NULL) {
203 208
		if (fflag && errno == ENOENT)
204 209
			return;
......
624 629
{
625 630

  
626 631
	fprintf(stderr, "%s\n%s\n",
627
	    "usage: rm [-f | -i] [-dIPRrvW] file ...",
632
	    "usage: rm [-f | -i] [-dIPRrvWx] file ...",
628 633
	    "       unlink file");
629 634
	exit(EX_USAGE);
630 635
}