From f8a94f0de88c5cbf24ef4d5a7d5cba1ead86afff Mon Sep 17 00:00:00 2001 From: David Dykstra Date: Thu, 29 Aug 2002 14:37:20 +0000 Subject: [PATCH] Patch from J.W. Schultz to have --include-from and --exclude-from on filename "-" read from standard input. --- NEWS | 3 +++ exclude.c | 8 +++++++- rsync.yo | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index d0f34e3a..34e424ff 100644 --- 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 diff --git a/exclude.c b/exclude.c index dc469e18..23ee743d 100644 --- 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, diff --git a/rsync.yo b/rsync.yo index 6751ea27..93b06f92 100644 --- 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 -- 2.34.1