aboutsummaryrefslogtreecommitdiffstats
path: root/batch.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2004-07-19 00:53:49 +0000
committerWayne Davison <wayned@samba.org>2004-07-19 00:53:49 +0000
commitb462781fd06838f95aa26ca7e868c87809483f05 (patch)
treed5c89a44c8b21dfee079d9c069935c129a57a973 /batch.c
parent93095cbe99154752c92c1d112cac139852b715a5 (diff)
downloadandroid_external_rsync-b462781fd06838f95aa26ca7e868c87809483f05.tar.gz
android_external_rsync-b462781fd06838f95aa26ca7e868c87809483f05.tar.bz2
android_external_rsync-b462781fd06838f95aa26ca7e868c87809483f05.zip
Fixed the argv munging to work properly regardless of whether the
user specified a trailing '=VALUE' or put the value in a separate arg.
Diffstat (limited to 'batch.c')
-rw-r--r--batch.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/batch.c b/batch.c
index 5373a484..8d3f7961 100644
--- a/batch.c
+++ b/batch.c
@@ -16,7 +16,7 @@ void write_batch_argvs_file(int argc, char *argv[])
char filename[MAXPATHLEN];
stringjoin(filename, sizeof filename,
- batch_name, ".rsync_argvs", NULL);
+ batch_name, ".sh", NULL);
fd = do_open(filename, O_WRONLY | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR | S_IEXEC);
if (fd < 0) {
@@ -28,13 +28,16 @@ void write_batch_argvs_file(int argc, char *argv[])
for (i = 0; i < argc; i++) {
if (i == argc - 2) /* Skip source directory on cmdline */
continue;
- if (strncmp(argv[i], "--files-from=", 13) == 0)
+ if (strncmp(argv[i], "--files-from", 12) == 0) {
+ if (strchr(argv[i], '=') == NULL)
+ i++;
continue;
+ }
if (i != 0)
write(fd, " ", 1);
- if (strncmp(argv[i], "--write-batch=", 14) == 0) {
- write(fd, "--read-batch=", 13);
- write(fd, batch_name, strlen(batch_name));
+ if (strncmp(argv[i], "--write-batch", 13) == 0) {
+ write(fd, "--read", 6);
+ write(fd, argv[i] + 7, strlen(argv[i] + 7));
} else if (i == argc - 1) {
char *p = find_colon(argv[i]);
if (p) {