commit be6e177f6e9b525e0c922b4a074550d81905331d
parent 4c6c3798125fdb022a265b1e56642bebb7affa30
Author: Connor Lane Smith <cls@lubutu.com>
Date: Tue, 24 May 2011 12:32:33 +0100
fix rm -f
Diffstat:
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/rm.1 b/rm.1
@@ -11,7 +11,7 @@ removes the given files and directories.
.SH OPTIONS
.TP
.B \-f
-ignored, for compatibility.
+ignore files that cannot be removed.
.TP
.B \-r
remove directories recursively.
diff --git a/rm.c b/rm.c
@@ -10,7 +10,8 @@
static void rm(const char *);
-static bool rflag = 0;
+static bool fflag = false;
+static bool rflag = false;
int
main(int argc, char *argv[])
@@ -20,6 +21,7 @@ main(int argc, char *argv[])
while((c = getopt(argc, argv, "fr")) != -1)
switch(c) {
case 'f':
+ fflag = true;
break;
case 'r':
rflag = true;
@@ -54,5 +56,6 @@ void rm(const char *path)
if(remove(path) == 0)
return;
}
- eprintf("remove %s:", path);
+ if(!fflag)
+ eprintf("remove %s:", path);
}