summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-03-07 20:01:35 +0000
committerJim Meyering <jim@meyering.net>2003-03-07 20:01:35 +0000
commit2b1a18e68297c677d10df2a2b380c346e46d55ee (patch)
tree62df5b0e63c11fe31adb0c1b84e4c861a0fcd79f /src
parent07434548fae83c06d902a399e2d3d9bfbc7c50c3 (diff)
downloadcoreutils-2b1a18e68297c677d10df2a2b380c346e46d55ee.tar.xz
Remove everything associated with mmap-stack.c.
This reverts the two changes of 2003-02-21.
Diffstat (limited to 'src')
-rw-r--r--src/cp.c36
1 files 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);
}