this patch give your rm command (with options -v) print name of removing file:
rm.cThu Jun 22 22:57:47 2006
rm.c.oldThu Jun 22 22:57:19 2006
@@ -63,7 +63,7 @@
extern char progname;
-int dflag, eval, fflag, iflag, Pflag, stdin_ok,pflag;
+int dflag, eval, fflag, iflag, Pflag, stdin_ok;
intcheck(char *, char *, struct stat *);
voidcheckdot(char **);
@@ -72,7 +72,7 @@
intpass(int, int, off_t, char *, size_t);
voidrm_tree(char **);
voidusage(void);
-void print_file_name(char*);
+
/*
* rm --
*This rm is different from historic rm's, but is expected to match
@@ -88,7 +88,7 @@
setlocale(LC_ALL, "");
Pflag = rflag = 0;
-while ((ch = getopt(argc, argv, "dfiPRrv")) != -1)
+while ((ch = getopt(argc, argv, "dfiPRr")) != -1)
switch(ch) {
case 'd':
dflag = 1;
@@ -106,11 +106,8 @@
break;
case 'R':
case 'r':/* Compatibility. */
- rflag = 1;
- break;
-case 'v': /*Print name of the removing file*/
- pflag=1;
- break;
+rflag = 1;
+break;
default:
usage();
}
@@ -160,7 +157,6 @@
if (!(fts = fts_open(argv, flags, NULL)))
err(1, NULL);
while ((p = fts_read(fts)) != NULL) {
- print_file_name(p->fts_path);
switch (p->fts_info) {
case FTS_DNR:
if (!fflag || p->fts_errno != ENENT) {
@@ -222,7 +218,7 @@
continue;
if (!unlink(p->fts_accpath) ||
(fflag && errno == ENENT))
- continue;
+continue;
}
warn("%s", p->fts_path);
eval = 1;
@@ -237,6 +233,7 @@
struct stat sb;
int rval;
char *f;
+
/*
* Remove a file. PSIX 1003.2 states that, by default, attempting
* to remove a directory is an error, so must always stat the file.
@@ -265,7 +262,6 @@
if (!rm_overwrite(f, &sb))
continue;
rval = unlink(f);
-print_file_name(f);
}
if (rval && (!fflag || errno != ENENT)) {
warn("%s", f);
@@ -425,12 +421,6 @@
void
usage(void)
{
-(void)fprintf(stderr, "usage: %s [-dfiPRrv] file \n", __progname);
+(void)fprintf(stderr, "usage: %s [-dfiPRr] file \n", __progname);
exit(1);
-}
-
-void print_file_name(char*s)
-{
- if(pflag)
- printf("Removing: %s\n",s);
}