added --size-only option. Useful when starting to use rsync after a
[rsync/rsync.git] / options.c
index ed01a67..aff2a3a 100644 (file)
--- a/options.c
+++ b/options.c
@@ -59,7 +59,9 @@ int do_stats=0;
 int do_progress=0;
 int keep_partial=0;
 int safe_symlinks=0;
+int copy_unsafe_links=0;
 int block_size=BLOCK_SIZE;
+int size_only=0;
 
 char *backup_suffix = BACKUP_SUFFIX;
 char *tmpdir = NULL;
@@ -104,6 +106,7 @@ void usage(int F)
   rprintf(F," -u, --update                update only (don't overwrite newer files)\n");
   rprintf(F," -l, --links                 preserve soft links\n");
   rprintf(F," -L, --copy-links            treat soft links like regular files\n");
+  rprintf(F,"     --copy-unsafe-links     copy links outside the source tree\n");
   rprintf(F,"     --safe-links            ignore links outside the destination tree\n");
   rprintf(F," -H, --hard-links            preserve hard links\n");
   rprintf(F," -p, --perms                 preserve permissions\n");
@@ -125,6 +128,7 @@ void usage(int F)
   rprintf(F,"     --numeric-ids           don't map uid/gid values by user/group name\n");
   rprintf(F,"     --timeout=TIME          set IO timeout in seconds\n");
   rprintf(F," -I, --ignore-times          don't exclude files that match length and time\n");
+  rprintf(F,"     --size-only             only use file size when determining if a file should be transferred\n");
   rprintf(F," -T  --temp-dir=DIR          create temporary files in directory DIR\n");
   rprintf(F,"     --compare-dest=DIR      also compare destination files relative to DIR\n");
   rprintf(F," -z, --compress              compress file data\n");
@@ -152,7 +156,8 @@ enum {OPT_VERSION,OPT_SUFFIX,OPT_SENDER,OPT_SERVER,OPT_EXCLUDE,
       OPT_EXCLUDE_FROM,OPT_DELETE,OPT_NUMERIC_IDS,OPT_RSYNC_PATH,
       OPT_FORCE,OPT_TIMEOUT,OPT_DAEMON,OPT_CONFIG,OPT_PORT,
       OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_STATS, OPT_PARTIAL, OPT_PROGRESS,
-      OPT_SAFE_LINKS, OPT_COMPARE_DEST, OPT_LOG_FORMAT,OPT_PASSWORD_FILE};
+      OPT_COPY_UNSAFE_LINKS, OPT_SAFE_LINKS, OPT_COMPARE_DEST,
+      OPT_LOG_FORMAT, OPT_PASSWORD_FILE, OPT_SIZE_ONLY};
 
 static char *short_options = "oblLWHpguDCtcahvqrRIxnSe:B:T:z";
 
@@ -171,6 +176,7 @@ static struct option long_options[] = {
   {"password-file", 1, 0,     OPT_PASSWORD_FILE},
   {"one-file-system",0,  0,    'x'},
   {"ignore-times",0,     0,    'I'},
+  {"size-only",   0,     0,    OPT_SIZE_ONLY},
   {"help",        0,     0,    'h'},
   {"dry-run",     0,     0,    'n'},
   {"sparse",      0,     0,    'S'},
@@ -187,6 +193,7 @@ static struct option long_options[] = {
   {"perms",       0,     0,    'p'},
   {"links",       0,     0,    'l'},
   {"copy-links",  0,     0,    'L'},
+  {"copy-unsafe-links", 0, 0,  OPT_COPY_UNSAFE_LINKS},
   {"safe-links",  0,     0,    OPT_SAFE_LINKS},
   {"whole-file",  0,     0,    'W'},
   {"hard-links",  0,     0,    'H'},
@@ -285,10 +292,15 @@ int parse_arguments(int argc, char *argv[], int frommain)
                case OPT_PASSWORD_FILE:
                        password_file =optarg;
                        break;          
+
                case 'I':
                        ignore_times = 1;
                        break;
 
+               case OPT_SIZE_ONLY:
+                       size_only = 1;
+                       break;
+
                case 'x':
                        one_file_system=1;
                        break;
@@ -321,6 +333,10 @@ int parse_arguments(int argc, char *argv[], int frommain)
                        add_exclude_file(optarg,1, 1);
                        break;
 
+               case OPT_COPY_UNSAFE_LINKS:
+                       copy_unsafe_links=1;
+                       break;
+
                case OPT_SAFE_LINKS:
                        safe_symlinks=1;
                        break;
@@ -578,12 +594,18 @@ void server_options(char **args,int *argc)
        if (delete_mode)
                args[ac++] = "--delete";
 
+       if (size_only)
+               args[ac++] = "--size-only";
+
        if (keep_partial)
                args[ac++] = "--partial";
 
        if (force_delete)
                args[ac++] = "--force";
 
+       if (copy_unsafe_links)
+               args[ac++] = "--copy-unsafe-links";
+
        if (safe_symlinks)
                args[ac++] = "--safe-links";