[patch] exclude-from stdin

jw schultz jw at pegasys.ws
Fri Aug 2 17:56:02 EST 2002


This patch causes --exclude-from and --include-from to read
from STDIN when given - for a filename.

This was formerly incorporated in my --link-dest patch.

Patch against current cvs.


-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw at pegasys.ws

		Remember Cernan and Schmitt
-------------- next part --------------
? rsync.yo1
Index: exclude.c
===================================================================
RCS file: /cvsroot/rsync/exclude.c,v
retrieving revision 1.44
diff -u -r1.44 exclude.c
--- exclude.c	11 Apr 2002 02:25:53 -0000	1.44
+++ exclude.c	3 Aug 2002 00:09:54 -0000
@@ -220,8 +220,14 @@
 					  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: rsync.yo
===================================================================
RCS file: /cvsroot/rsync/rsync.yo,v
retrieving revision 1.105
diff -u -r1.105 rsync.yo
--- rsync.yo	1 Aug 2002 17:55:40 -0000	1.105
+++ rsync.yo	3 Aug 2002 00:09:55 -0000
@@ -617,6 +617,8 @@
 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 \fIFILE\fP is \fB-\fP 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 @@
 
 dit(bf(--include-from=FILE)) This specifies a list of include patterns
 from a file.
+If \fIFILE\fP is \fB-\fP 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


More information about the rsync mailing list