diff options
| author | Wayne Davison <wayned@samba.org> | 2006-02-23 00:38:34 +0000 |
|---|---|---|
| committer | Wayne Davison <wayned@samba.org> | 2006-02-23 00:38:34 +0000 |
| commit | ee8e2b15478e93d1ba340bb3f8dfb5e854766d53 (patch) | |
| tree | 369adc76166fbf9f09d4fb3630c84e804ca61d9b /main.c | |
| parent | 5fa38cd679f73cd21b6e3fd633492756b7436c0e (diff) | |
| download | android_external_rsync-ee8e2b15478e93d1ba340bb3f8dfb5e854766d53.tar.gz android_external_rsync-ee8e2b15478e93d1ba340bb3f8dfb5e854766d53.tar.bz2 android_external_rsync-ee8e2b15478e93d1ba340bb3f8dfb5e854766d53.zip | |
Rsync no longer returns a usage error when used with one local
source arg and no destination: this now implies the --list-only
option, just like one remote source arg has always done.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -457,7 +457,7 @@ static char *get_local_name(struct file_list *flist, char *dest_path) flist->count, NS(dest_path)); } - if (!dest_path) + if (!dest_path || list_only) return NULL; /* If the destination path refers to an existing directory, enter @@ -960,12 +960,12 @@ static int start_client(int argc, char *argv[]) return rc; if (!read_batch) { /* for read_batch, NO source is specified */ - argc--; shell_path = check_for_hostspec(argv[0], &shell_machine, &rsync_port); if (shell_path) { /* source is remote */ char *dummy1; int dummy2; - if (argc && check_for_hostspec(argv[argc], &dummy1, &dummy2)) { + if (--argc + && check_for_hostspec(argv[argc], &dummy1, &dummy2)) { rprintf(FERROR, "The source and destination cannot both be remote.\n"); exit_cleanup(RERR_SYNTAX); @@ -990,12 +990,14 @@ static int start_client(int argc, char *argv[]) } else { /* source is local, check dest arg */ am_sender = 1; - if (argc < 1) { /* destination required */ - usage(FERROR); - exit_cleanup(RERR_SYNTAX); + if (argc > 1) + p = argv[--argc]; + else { + p = "."; + list_only = 1; } - shell_path = check_for_hostspec(argv[argc], &shell_machine, &rsync_port); + shell_path = check_for_hostspec(p, &shell_machine, &rsync_port); if (shell_path && filesfrom_host && *filesfrom_host && strcmp(filesfrom_host, shell_machine) != 0) { rprintf(FERROR, @@ -1010,7 +1012,7 @@ static int start_client(int argc, char *argv[]) exit_cleanup(RERR_SYNTAX); } shell_machine = NULL; - shell_path = argv[argc]; + shell_path = p; } else if (rsync_port) { if (!shell_cmd) { return start_socket_client(shell_machine, |
