diff options
author | Michael Haro <mharo@FreeBSD.org> | 1999-09-04 03:40:10 +0000 |
---|---|---|
committer | Michael Haro <mharo@FreeBSD.org> | 1999-09-04 03:40:10 +0000 |
commit | 777d1f82817d6832224e8ef1678f6041f44693fa (patch) | |
tree | 169090483365fcad2bf2dbc1723042f1f59bd498 /bin | |
parent | 234c2f5b6e6ee609c8012d4aff287f09e7aa6aea (diff) | |
download | src-test2-777d1f82817d6832224e8ef1678f6041f44693fa.tar.gz src-test2-777d1f82817d6832224e8ef1678f6041f44693fa.zip |
Notes
Diffstat (limited to 'bin')
-rw-r--r-- | bin/rm/rm.1 | 9 | ||||
-rw-r--r-- | bin/rm/rm.c | 34 |
2 files changed, 25 insertions, 18 deletions
diff --git a/bin/rm/rm.1 b/bin/rm/rm.1 index d386c3bf6fff..0c4b740f1543 100644 --- a/bin/rm/rm.1 +++ b/bin/rm/rm.1 @@ -43,7 +43,7 @@ .Nd remove directory entries .Sh SYNOPSIS .Nm rm -.Op Fl dfiPRrWv +.Op Fl dfiPRrvW .Ar file ... .Sh DESCRIPTION The @@ -99,12 +99,12 @@ that directory is skipped. .It Fl r Equivalent to .Fl R . +.It Fl v +Be verbose when deleting files, showing them as they are removed. .It Fl W Attempt to undelete the named files. Currently, this option can only be used to recover files covered by whiteouts. -.It Fl v -Be verbose when deleting files, showing them as they are removed. .El .Pp The @@ -166,6 +166,9 @@ utility differs from historical implementations in that the .Fl f option only masks attempts to remove non-existent files instead of masking a large variety of errors. +The +.Fl v +option is non-standard and its use in scripts is not recommended. .Pp Also, historical .Bx diff --git a/bin/rm/rm.c b/bin/rm/rm.c index 7467748b1c20..5a4f87a68383 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -63,7 +63,7 @@ static const char rcsid[] = extern char *flags_to_string __P((u_long, char *)); -int dflag, eval, fflag, iflag, Pflag, Wflag, vflag, stdin_ok; +int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok; uid_t uid; int check __P((char *, char *, struct stat *)); @@ -88,7 +88,7 @@ main(argc, argv) int ch, rflag; Pflag = rflag = 0; - while ((ch = getopt(argc, argv, "dfiPRrWv")) != -1) + while ((ch = getopt(argc, argv, "dfiPRrvW")) != -1) switch(ch) { case 'd': dflag = 1; @@ -108,12 +108,12 @@ main(argc, argv) case 'r': /* Compatibility. */ rflag = 1; break; - case 'W': - Wflag = 1; - break; case 'v': vflag = 1; break; + case 'W': + Wflag = 1; + break; default: usage(); } @@ -150,6 +150,7 @@ rm_tree(argv) int needstat; int flags; int rval; + int e; /* * Remove a file hierarchy. If forcing removal (-f), or interactive @@ -226,7 +227,6 @@ rm_tree(argv) rval = chflags(p->fts_accpath, p->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE)); if (!rval) { - int e; /* * If we can't read or search the directory, may still be * able to remove it. Don't print out the un{read,search}able @@ -235,19 +235,21 @@ rm_tree(argv) switch (p->fts_info) { case FTS_DP: case FTS_DNR: - if ((e=rmdir(p->fts_accpath)) == 0 || - (fflag && errno == ENOENT)) { + e = rmdir(p->fts_accpath); + if (e == 0 || (fflag && errno == ENOENT)) { if (e == 0 && vflag) - (void)printf("%s\n", p->fts_accpath); + (void)printf("%s\n", + p->fts_accpath); continue; } break; case FTS_W: - if (!(e=undelete(p->fts_accpath)) || - (fflag && errno == ENOENT)) { + e = undelete(p->fts_accpath); + if (e == 0 || (fflag && errno == ENOENT)) { if (e == 0 && vflag) - (void)printf("%s\n", p->fts_accpath); + (void)printf("%s\n", + p->fts_accpath); continue; } break; @@ -255,9 +257,11 @@ rm_tree(argv) default: if (Pflag) rm_overwrite(p->fts_accpath, NULL); - if (!(e=unlink(p->fts_accpath)) || (fflag && errno == ENOENT)) { + e = unlink(p->fts_accpath); + if (e == 0 || (fflag && errno == ENOENT)) { if (e == 0 && vflag) - (void)printf("%s\n", p->fts_accpath); + (void)printf("%s\n", + p->fts_accpath); continue; } } @@ -468,6 +472,6 @@ checkdot(argv) void usage() { - (void)fprintf(stderr, "usage: rm [-f | -i] [-dPRrWv] file ...\n"); + (void)fprintf(stderr, "usage: rm [-f | -i] [-dPRrvW] file ...\n"); exit(EX_USAGE); } |