fix rm -f
This commit is contained in:
parent
4c6c379812
commit
be6e177f6e
2
rm.1
2
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.
|
||||
|
|
5
rm.c
5
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;
|
||||
}
|
||||
if(!fflag)
|
||||
eprintf("remove %s:", path);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user