diff options
author | Jim Meyering <jim@meyering.net> | 2002-06-02 20:50:33 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2002-06-02 20:50:33 +0000 |
commit | 0f6d0c6016b2502aca42bba20b068e554236c58b (patch) | |
tree | 845446ba23f0b10879473c05712c7af06809024a /src | |
parent | a4b18d89614bc970bd388571195295b454df3fcf (diff) | |
download | coreutils-0f6d0c6016b2502aca42bba20b068e554236c58b.tar.xz |
(main): Adapt to new calling sequence for rm.
Diffstat (limited to 'src')
-rw-r--r-- | src/rm.c | 36 |
1 files changed, 8 insertions, 28 deletions
@@ -16,7 +16,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by Paul Rubin, David MacKenzie, and Richard Stallman. - Reworked to use chdir and hash tables by Jim Meyering. */ + Reworked to use chdir and avoid recursion by Jim Meyering. */ /* Implementation overview: @@ -185,35 +185,15 @@ main (int argc, char **argv) } } - remove_init (); - { - struct stat cwd_sb; - struct dev_ino cwd_dev_ino; - - /* FIXME: this lstat is not always necessary -- e.g., if there are no - directories, or if all directories arguments are specified via - absolute names. */ - if (lstat (".", &cwd_sb)) - error (EXIT_FAILURE, errno, _("cannot lstat `.'")); - - cwd_dev_ino.st_dev = cwd_sb.st_dev; - cwd_dev_ino.st_ino = cwd_sb.st_ino; - - for (; optind < argc; optind++) - { - struct File_spec fs; - enum RM_status status; - - fspec_init_file (&fs, argv[optind]); - status = rm (&fs, 1, &x, &cwd_dev_ino); - assert (VALID_STATUS (status)); - if (status == RM_ERROR) - fail = 1; - } - } + size_t n_files = argc - optind; + char const *const *file = (char const *const *) argv + optind; - remove_fini (); + enum RM_status status = rm (n_files, file, &x); + assert (VALID_STATUS (status)); + if (status == RM_ERROR) + fail = 1; + } exit (fail); } |