diff options
author | mharo <mharo@FreeBSD.org> | 1999-09-04 03:40:10 +0000 |
---|---|---|
committer | mharo <mharo@FreeBSD.org> | 1999-09-04 03:40:10 +0000 |
commit | 199f72f333a7bbee882c3453d3def30c4ed50ad9 (patch) | |
tree | 5f9a419f347c50e8833915acefd005cc86077bcc /bin | |
parent | 5012b180b88a15f504dc4910b8b5af34bfab62d6 (diff) | |
download | FreeBSD-src-199f72f333a7bbee882c3453d3def30c4ed50ad9.zip FreeBSD-src-199f72f333a7bbee882c3453d3def30c4ed50ad9.tar.gz |
brucify, `v' before `W', mention -v is non-standard in manpage and
make code slightly easier to read
Reviewed by: obrien
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 d386c3b..0c4b740 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 7467748..5a4f87a 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); } |