Patch from J.W. Schultz to have --include-from and --exclude-from on
authorDavid Dykstra <dwd@samba.org>
Thu, 29 Aug 2002 14:37:20 +0000 (14:37 +0000)
committerDavid Dykstra <dwd@samba.org>
Thu, 29 Aug 2002 14:37:20 +0000 (14:37 +0000)
filename "-" read from standard input.

NEWS
exclude.c
rsync.yo

diff --git a/NEWS b/NEWS
index d0f34e3..34e424f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,9 @@ rsync changes since last release
     * The rsync:// syntax for daemon connections is now accepted in the
       destination field.
 
+    * If the file name given to --include-from or --exclude-from is "-",
+      rsync will read from standard input. (J.W. Schultz)
+
   BUG FIXES:
   
     * Fix "forward name lookup failed" errors on AIX 4.3.3.  (John
index dc469e1..23ee743 100644 (file)
--- a/exclude.c
+++ b/exclude.c
@@ -220,8 +220,14 @@ struct exclude_struct **make_exclude_list(const char *fname,
                                          int fatal, int include)
 {
        struct exclude_struct **list=list1;
-       FILE *f = fopen(fname,"r");
+       FILE *f;
        char line[MAXPATHLEN];
+
+       if (strcmp(fname, "-")) {
+               f = fopen(fname,"r");
+       } else {
+               f = fdopen(0, "r");
+       }
        if (!f) {
                if (fatal) {
                        rsyserr(FERROR, errno,
index 6751ea2..93b06f9 100644 (file)
--- a/rsync.yo
+++ b/rsync.yo
@@ -617,6 +617,8 @@ dit(bf(--exclude-from=FILE)) This option is similar to the --exclude
 option, but instead it adds all exclude patterns listed in the file
 FILE to the exclude list.  Blank lines in FILE and lines starting with
 ';' or '#' are ignored.
+If em(FILE) is bf(-) the list will be read from standard input.
+
 
 dit(bf(--include=PATTERN)) This option tells rsync to not exclude the
 specified pattern of filenames. This is useful as it allows you to
@@ -627,6 +629,8 @@ this option.
 
 dit(bf(--include-from=FILE)) This specifies a list of include patterns
 from a file.
+If em(FILE) is bf(-) the list will be read from standard input.
+
 
 dit(bf(-C, --cvs-exclude)) This is a useful shorthand for excluding a
 broad range of files that you often don't want to transfer between