Use the new SIZEOF_INT64 define instead of INT64_IS_OFF_T.
[rsync/rsync.git] / options.c
index 3082e5c..5ab7b7f 100644 (file)
--- a/options.c
+++ b/options.c
@@ -101,6 +101,7 @@ int modify_window = 0;
 int blocking_io = -1;
 int checksum_seed = 0;
 int inplace = 0;
+int delay_updates = 0;
 long block_size = 0; /* "long" because popt can't set an int32. */
 
 
@@ -191,7 +192,7 @@ static void print_rsync_version(enum logcode f)
        rprintf(f, "%s  version %s  protocol version %d\n",
                RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION);
        rprintf(f,
-               "Copyright (C) 1996-2004 by Andrew Tridgell and others\n");
+               "Copyright (C) 1996-2005 by Andrew Tridgell and others\n");
        rprintf(f, "<http://rsync.samba.org/>\n");
        rprintf(f, "Capabilities: %d-bit files, %ssocketpairs, "
                "%shard links, %ssymlinks, batchfiles, \n",
@@ -210,9 +211,8 @@ static void print_rsync_version(enum logcode f)
                get_panic_action());
 #endif
 
-#ifdef INT64_IS_OFF_T
-       if (sizeof (int64) < 8)
-               rprintf(f, "WARNING: no 64-bit integers on this platform!\n");
+#if SIZEOF_INT64 < 8
+       rprintf(f, "WARNING: no 64-bit integers on this platform!\n");
 #endif
 
        rprintf(f,
@@ -288,6 +288,7 @@ void usage(enum logcode F)
   rprintf(F,"     --max-size=SIZE         don't transfer any file larger than SIZE\n");
   rprintf(F,"     --partial               keep partially transferred files\n");
   rprintf(F,"     --partial-dir=DIR       put a partially transferred file into DIR\n");
+  rprintf(F,"     --delay-updates         update all transferred files into place at end\n");
   rprintf(F,"     --numeric-ids           don't map uid/gid values by user/group name\n");
   rprintf(F,"     --timeout=TIME          set I/O timeout in seconds\n");
   rprintf(F," -I, --ignore-times          turn off mod time & file size quick check\n");
@@ -407,6 +408,7 @@ static struct poptOption long_options[] = {
   {"progress",         0,  POPT_ARG_NONE,   &do_progress, 0, 0, 0 },
   {"partial",          0,  POPT_ARG_NONE,   &keep_partial, 0, 0, 0 },
   {"partial-dir",      0,  POPT_ARG_STRING, &partial_dir, 0, 0, 0 },
+  {"delay-updates",    0,  POPT_ARG_NONE,   &delay_updates, 0, 0, 0 },
   {"ignore-errors",    0,  POPT_ARG_NONE,   &ignore_errors, 0, 0, 0 },
   {"blocking-io",      0,  POPT_ARG_VAL,    &blocking_io, 1, 0, 0 },
   {"no-blocking-io",   0,  POPT_ARG_VAL,    &blocking_io, 0, 0, 0 },
@@ -995,11 +997,15 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
                        bwlimit_writemax = 512;
        }
 
+       if (delay_updates && !partial_dir)
+               partial_dir = ".~tmp~";
+
        if (inplace) {
 #if HAVE_FTRUNCATE
                if (partial_dir) {
                        snprintf(err_buf, sizeof err_buf,
-                                "--inplace cannot be used with --partial-dir\n");
+                                "--inplace cannot be used with --%s\n",
+                                delay_updates ? "delay-updates" : "partial-dir");
                        return 0;
                }
                keep_partial = 0;
@@ -1236,6 +1242,8 @@ void server_options(char **args,int *argc)
        if (partial_dir && am_sender) {
                args[ac++] = "--partial-dir";
                args[ac++] = partial_dir;
+               if (delay_updates)
+                       args[ac++] = "--delay-updates";
        } else if (keep_partial)
                args[ac++] = "--partial";