continue calling waitpid() while still reapingchildren (patch from
[rsync/rsync.git] / options.c
index 6757144..abdfff3 100644 (file)
--- a/options.c
+++ b/options.c
@@ -37,6 +37,7 @@ int dry_run=0;
 int local_server=0;
 int ignore_times=0;
 int delete_mode=0;
+int delete_excluded=0;
 int one_file_system=0;
 int remote_version=0;
 int sparse_files=0;
@@ -54,13 +55,13 @@ int am_server = 0;
 int am_sender=0;
 int recurse = 0;
 int am_daemon=0;
-int am_client=0;
 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;
@@ -122,11 +123,13 @@ void usage(int F)
   rprintf(F,"     --rsync-path=PATH       specify path to rsync on the remote machine\n");
   rprintf(F," -C, --cvs-exclude           auto ignore files in the same way CVS does\n");
   rprintf(F,"     --delete                delete files that don't exist on the sending side\n");
+  rprintf(F,"     --delete-excluded       also delete excluded files on the receiving side\n");
   rprintf(F,"     --partial               keep partially transferred files\n");
   rprintf(F,"     --force                 force deletion of directories even if not empty\n");
   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");
@@ -150,12 +153,12 @@ void usage(int F)
   rprintf(F,"See http://rsync.samba.org/ for updates and bug reports\n");
 }
 
-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,
+enum {OPT_VERSION, OPT_SUFFIX, OPT_SENDER, OPT_SERVER, OPT_EXCLUDE,
+      OPT_EXCLUDE_FROM, OPT_DELETE, OPT_DELETE_EXCLUDED, 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_COPY_UNSAFE_LINKS, OPT_SAFE_LINKS, OPT_COMPARE_DEST,
-      OPT_LOG_FORMAT, OPT_PASSWORD_FILE};
+      OPT_LOG_FORMAT, OPT_PASSWORD_FILE, OPT_SIZE_ONLY};
 
 static char *short_options = "oblLWHpguDCtcahvqrRIxnSe:B:T:z";
 
@@ -164,6 +167,7 @@ static struct option long_options[] = {
   {"server",      0,     0,    OPT_SERVER},
   {"sender",      0,     0,    OPT_SENDER},
   {"delete",      0,     0,    OPT_DELETE},
+  {"delete-excluded", 0, 0,    OPT_DELETE_EXCLUDED},
   {"force",       0,     0,    OPT_FORCE},
   {"numeric-ids", 0,     0,    OPT_NUMERIC_IDS},
   {"exclude",     1,     0,    OPT_EXCLUDE},
@@ -174,6 +178,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'},
@@ -289,10 +294,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;
@@ -301,6 +311,11 @@ int parse_arguments(int argc, char *argv[], int frommain)
                        delete_mode = 1;
                        break;
 
+               case OPT_DELETE_EXCLUDED:
+                       delete_excluded = 1;
+                       delete_mode = 1;
+                       break;
+
                case OPT_FORCE:
                        force_delete = 1;
                        break;
@@ -583,9 +598,15 @@ void server_options(char **args,int *argc)
                args[ac++] = backup_suffix;
        }
 
-       if (delete_mode)
+       if (delete_mode && !delete_excluded)
                args[ac++] = "--delete";
 
+       if (delete_excluded)
+               args[ac++] = "--delete-excluded";
+
+       if (size_only)
+               args[ac++] = "--size-only";
+
        if (keep_partial)
                args[ac++] = "--partial";