Remove everything associated with mmap-stack.c.
authorJim Meyering <jim@meyering.net>
Fri, 7 Mar 2003 20:01:35 +0000 (20:01 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 7 Mar 2003 20:01:35 +0000 (20:01 +0000)
This reverts the two changes of 2003-02-21.

src/cp.c

index 3079cb4..adcb7b9 100644 (file)
--- 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);
 }