Allow --read-batch=- to indicate stdin.
authorWayne Davison <wayned@samba.org>
Thu, 15 Jul 2004 17:01:51 +0000 (17:01 +0000)
committerWayne Davison <wayned@samba.org>
Thu, 15 Jul 2004 17:01:51 +0000 (17:01 +0000)
main.c

diff --git a/main.c b/main.c
index e0a9045543f5faffca911b8466d4c0e89698b97c..a94dfe8f25e1f257163b9c9b57aff4bb55c7d619 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1074,9 +1074,13 @@ int main(int argc,char *argv[])
                if (write_batch)
                        write_batch_argvs_file(orig_argc, orig_argv);
 
-               batch_fd = do_open(batch_name,
+               if (read_batch && strcmp(batch_name, "-") == 0)
+                       batch_fd = STDIN_FILENO;
+               else {
+                       batch_fd = do_open(batch_name,
                                   write_batch ? O_WRONLY | O_CREAT | O_TRUNC
                                   : O_RDONLY, S_IRUSR | S_IWUSR);
+               }
                if (batch_fd < 0) {
                        rsyserr(FERROR, errno, "Batch file %s open error",
                                batch_name);