Restored changes accidentally backed out by Dave Dykstra in previous revision.
[rsync/rsync.git] / exclude.c
index dc469e1..e1b2588 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,
@@ -235,7 +241,7 @@ struct exclude_struct **make_exclude_list(const char *fname,
 
        while (fgets(line,MAXPATHLEN,f)) {
                int l = strlen(line);
-               if (l && line[l-1] == '\n') l--;
+               while (l && (line[l-1] == '\n' || line[l-1] == '\r')) l--;
                line[l] = 0;
                if (line[0] && (line[0] != ';') && (line[0] != '#')) {
                        /* Skip lines starting with semicolon or pound.
@@ -387,12 +393,11 @@ void add_include_line(char *p)
 
 
 static char *cvs_ignore_list[] = {
-  "RCS","SCCS","CVS","CVS.adm","RCSLOG","cvslog.*",
-  "tags","TAGS",".make.state",".nse_depinfo",
-  "*~", "#*", ".#*", ",*", "*.old", "*.bak", "*.BAK", "*.orig",
+  "RCS/", "SCCS/", "CVS/", ".svn/", "CVS.adm", "RCSLOG", "cvslog.*",
+  "tags", "TAGS", ".make.state", ".nse_depinfo",
+  "*~", "#*", ".#*", ", *", "*.old", "*.bak", "*.BAK", "*.orig",
   "*.rej", ".del-*", "*.a", "*.o", "*.obj", "*.so", "*.Z", "*.elc", "*.ln",
-  "core",NULL};
-
+  "core", NULL};
 
 
 void add_cvs_excludes(void)