summaryrefslogtreecommitdiffstats
path: root/bin/rm
diff options
context:
space:
mode:
authormharo <mharo@FreeBSD.org>1999-11-28 09:34:21 +0000
committermharo <mharo@FreeBSD.org>1999-11-28 09:34:21 +0000
commitfa90e16b7d97621b55c84e4203a37877b598876f (patch)
tree330de55c4684f76a6df8f4c5670d13d0d96be629 /bin/rm
parent38cffb40f9d1d9ec8b67ebd13661c131e06416b1 (diff)
downloadFreeBSD-src-fa90e16b7d97621b55c84e4203a37877b598876f.zip
FreeBSD-src-fa90e16b7d97621b55c84e4203a37877b598876f.tar.gz
brucify
Reviewed by: obrien
Diffstat (limited to 'bin/rm')
-rw-r--r--bin/rm/rm.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/bin/rm/rm.c b/bin/rm/rm.c
index c12872b..7d7de4b 100644
--- a/bin/rm/rm.c
+++ b/bin/rm/rm.c
@@ -150,7 +150,6 @@ rm_tree(argv)
int needstat;
int flags;
int rval;
- int e;
/*
* Remove a file hierarchy. If forcing removal (-f), or interactive
@@ -226,7 +225,7 @@ rm_tree(argv)
!(p->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)))
rval = chflags(p->fts_accpath,
p->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE));
- if (!rval) {
+ if (rval == 0) {
/*
* 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,9 +234,9 @@ rm_tree(argv)
switch (p->fts_info) {
case FTS_DP:
case FTS_DNR:
- e = rmdir(p->fts_accpath);
- if (e == 0 || (fflag && errno == ENOENT)) {
- if (e == 0 && vflag)
+ rval = rmdir(p->fts_accpath);
+ if (rval == 0 || (fflag && errno == ENOENT)) {
+ if (rval == 0 && vflag)
(void)printf("%s\n",
p->fts_accpath);
continue;
@@ -245,9 +244,9 @@ rm_tree(argv)
break;
case FTS_W:
- e = undelete(p->fts_accpath);
- if (e == 0 || (fflag && errno == ENOENT)) {
- if (e == 0 && vflag)
+ rval = undelete(p->fts_accpath);
+ if (rval == 0 && (fflag && errno == ENOENT)) {
+ if (vflag)
(void)printf("%s\n",
p->fts_accpath);
continue;
@@ -257,9 +256,9 @@ rm_tree(argv)
default:
if (Pflag)
rm_overwrite(p->fts_accpath, NULL);
- e = unlink(p->fts_accpath);
- if (e == 0 || (fflag && errno == ENOENT)) {
- if (e == 0 && vflag)
+ rval = unlink(p->fts_accpath);
+ if (rval == 0 || (fflag && errno == ENOENT)) {
+ if (rval == 0 && vflag)
(void)printf("%s\n",
p->fts_accpath);
continue;
@@ -316,7 +315,7 @@ rm_file(argv)
(sb.st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
!(sb.st_flags & (SF_APPEND|SF_IMMUTABLE)))
rval = chflags(f, sb.st_flags & ~(UF_APPEND|UF_IMMUTABLE));
- if (!rval) {
+ if (rval == 0) {
if (S_ISWHT(sb.st_mode))
rval = undelete(f);
else if (S_ISDIR(sb.st_mode))
@@ -331,7 +330,7 @@ rm_file(argv)
warn("%s", f);
eval = 1;
}
- if (vflag)
+ if (vflag && rval == 0)
(void)printf("%s\n", f);
}
}
@@ -472,6 +471,7 @@ checkdot(argv)
void
usage()
{
+
(void)fprintf(stderr, "usage: rm [-f | -i] [-dPRrvW] file ...\n");
exit(EX_USAGE);
}
OpenPOWER on IntegriCloud