Submit #2546 ยป rm.patch
bin/rm/rm.1 | ||
---|---|---|
.It Fl r
|
||
Equivalent to
|
||
.Fl R .
|
||
.It Fl x
|
||
When removing a hierarchy, don't cross mount points.
|
||
.It Fl v
|
||
Be verbose when deleting files, showing them as they are removed.
|
||
.It Fl W
|
bin/rm/rm.c | ||
---|---|---|
#include <unistd.h>
|
||
static int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok;
|
||
static int rflag, Iflag;
|
||
static int rflag, Iflag, xflag;
|
||
static uid_t uid;
|
||
volatile sig_atomic_t info;
|
||
... | ... | |
exit(eval);
|
||
}
|
||
Pflag = rflag = 0;
|
||
while ((ch = getopt(argc, argv, "dfiIPRrvW")) != -1) {
|
||
Pflag = rflag = xflag = 0;
|
||
while ((ch = getopt(argc, argv, "dfiIPRrvWx")) != -1) {
|
||
switch(ch) {
|
||
case 'd':
|
||
dflag = 1;
|
||
... | ... | |
case 'W':
|
||
Wflag = 1;
|
||
break;
|
||
case 'x':
|
||
xflag = 1;
|
||
break;
|
||
default:
|
||
usage();
|
||
}
|
||
... | ... | |
flags |= FTS_NOSTAT;
|
||
if (Wflag)
|
||
flags |= FTS_WHITEOUT;
|
||
if (xflag)
|
||
flags |= FTS_XDEV;
|
||
if ((fts = fts_open(argv, flags, NULL)) == NULL) {
|
||
if (fflag && errno == ENOENT)
|
||
return;
|
||
... | ... | |
{
|
||
fprintf(stderr, "%s\n%s\n",
|
||
"usage: rm [-f | -i] [-dIPRrvW] file ...",
|
||
"usage: rm [-f | -i] [-dIPRrvWx] file ...",
|
||
" unlink file");
|
||
exit(EX_USAGE);
|
||
}
|