BSD

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • new in rm

    7 answers - 2330 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    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);
    }
  • No.1 | | 511 bytes | |

    Thu, Jun 22, 2006 at 11:29:06PM +0400, free-dev-serg wrote:
    this patch give your rm command (with options -v) print name of removing file:

    Why?
    - If used on the command line, you already know what you're deleting.
    - If you don't know what you're deleting, you'll get just your heart-attack
    faster.
    - When scripting, there are millions of other ways to tell what's
    happening.

    BTW: your patch looks a little bit desrever.

    Ciao,
    Kili
  • No.2 | | 583 bytes | |

    Thu, Jun 22, 2006 at 11:29:06PM +0400, free-dev-serg wrote:
    this patch give your rm command (with options -v) print name of removing
    file:

    Why?
    - If used on the command line, you already know what you're deleting.
    - If you don't know what you're deleting, you'll get just your
    heart-attack
    faster.
    - When scripting, there are millions of other ways to tell what's
    happening.

    BTW: your patch looks a little bit desrever.

    Ciao,
    Kili

    In other systems (Linux,FreeBSD,Minix3) rm have this options.
  • No.3 | | 842 bytes | |

    6/23/06, free-dev-serg <free-dev-serg (AT) yandex (DOT) ruwrote:
    Thu, Jun 22, 2006 at 11:29:06PM +0400, free-dev-serg wrote:
    this patch give your rm command (with options -v) print name of removing
    file:

    Why?

    - If used on the command line, you already know what you're deleting.
    - If you don't know what you're deleting, you'll get just your
    heart-attack
    faster.
    - When scripting, there are millions of other ways to tell what's
    happening.

    BTW: your patch looks a little bit desrever.

    Ciao,
    Kili
    --
    In other systems (Linux,FreeBSD,Minix3) rm have this options.

    Hahah

    And BSD isn't other systems. BSD is the one that tries to be
    correct as opposed to WELL I LIKE DEM BUCKETS DEM SURE ARE SHINY LESSA
    TAKE EM!
    -Nick
  • No.4 | | 604 bytes | |

    Thu, 22 Jun 2006, Matthias Kilian wrote:

    Thu, Jun 22, 2006 at 11:29:06PM +0400, free-dev-serg wrote:
    this patch give your rm command (with options -v) print name of removing file:

    Why?

    when doing "rm -rf /directory-with-lots-of-crap", it is useful to know
    how things are progressing.

    BTW: your patch looks a little bit desrever.

    More substantively:

    1) you don't need to wrap printf() in its own function - that is just
    silly indirection
    2) It should probably print the file/directory name *after* successfully
    removing it.
    -d
  • No.5 | | 268 bytes | |

    free-dev-serg wrote:
    -void print_file_name(char*s)
    -{
    - if(pflag)
    - printf("Removing: %s\n",s);
    }
    You already know it's an rm operation. Do we need "Removing: " for every
    file? Maybe -vv if you want very verbose.
    than that, I like. :)
  • No.6 | | 229 bytes | |

    re
    the more silly the idea the more attention it gets.
    would not it be awesome if all this attention be put into
    testing diffs sent for testing or even fixing real damn bugs?
    i suppose there are none left right?
    cu
  • No.7 | | 849 bytes | |

    6/23/06, Damien Miller <djm (AT) mindrot (DOT) orgwrote:
    Thu, 22 Jun 2006, Matthias Kilian wrote:

    Thu, Jun 22, 2006 at 11:29:06PM +0400, free-dev-serg wrote:
    this patch give your rm command (with options -v) print name of removing file:

    Why?

    when doing "rm -rf /directory-with-lots-of-crap", it is useful to know
    how things are progressing.

    BTW: your patch looks a little bit desrever.

    More substantively:

    1) you don't need to wrap printf() in its own function - that is just
    silly indirection
    2) It should probably print the file/directory name *after* successfully
    removing it.

    it could Print the file/directory name when it begins to remove and
    after a few dots print "K" once it is removed.

    Just a small suggestion.

    Kind Regards

    Siju

Re: new in rm


max 4000 letters.
Your nickname that display:
In order to stop the spam: 8 + 7 =
QUESTION ON "BSD"

EMSDN.COM