From 2b1a18e68297c677d10df2a2b380c346e46d55ee Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 7 Mar 2003 20:01:35 +0000 Subject: Remove everything associated with mmap-stack.c. This reverts the two changes of 2003-02-21. --- src/cp.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/src/cp.c b/src/cp.c index 3079cb44e..adcb7b97f 100644 --- a/src/cp.c +++ b/src/cp.c @@ -32,9 +32,8 @@ #include "backupfile.h" #include "copy.h" #include "cp-hash.h" -#include "dirname.h" #include "error.h" -#include "mmap-stack.h" +#include "dirname.h" #include "path-concat.h" #include "quote.h" @@ -120,6 +119,9 @@ static int const reply_vals[] = I_ALWAYS_YES, I_ALWAYS_NO, I_ASK_USER }; +/* The error code to return to the system. */ +static int exit_status = 0; + static struct option const long_opts[] = { {"archive", no_argument, NULL, 'a'}, @@ -824,25 +826,6 @@ decode_preserve_arg (char const *arg, struct cp_options *x, int on_off) free (arg_writable); } -static void run (size_t, char **, char const *, struct cp_options *) - ATTRIBUTE_NORETURN; -/* Encapsulate the `copy-and-exit' functionality. */ -static void -run (size_t n_files, char **files, char const *target_directory, - struct cp_options *x) -{ - int fail; - - /* Allocate space for remembering copied and created files. */ - hash_init (); - - fail = do_copy (n_files, files, target_directory, x); - - forget_all (); - - exit (fail ? EXIT_FAILURE : EXIT_SUCCESS); -} - int main (int argc, char **argv) { @@ -1067,6 +1050,13 @@ main (int argc, char **argv) if (x.unlink_dest_after_failed_open && (x.hard_link || x.symbolic_link)) x.unlink_dest_before_opening = 1; - RUN_WITH_BIG_STACK_4 (run, argc - optind, argv + optind, - target_directory, &x); + /* Allocate space for remembering copied and created files. */ + + hash_init (); + + exit_status |= do_copy (argc - optind, argv + optind, target_directory, &x); + + forget_all (); + + exit (exit_status); } -- cgit v1.2.3-70-g09d2