X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/587cb08dc4d83a005bfd6534d20d83ffe33e237d..d1be231290b3867648ee417fad341fdf1caaa94b:/exclude.c diff --git a/exclude.c b/exclude.c index bae5506f..109ee8d6 100644 --- a/exclude.c +++ b/exclude.c @@ -221,7 +221,7 @@ struct exclude_struct **make_exclude_list(char *fname, if (!f) { if (fatal) { rprintf(FERROR,"%s : %s\n",fname,strerror(errno)); - exit_cleanup(1); + exit_cleanup(RERR_FILEIO); } return list; } @@ -264,7 +264,7 @@ void send_exclude_list(int f) if (exclude_list[i]->include) { if (remote_version < 19) { rprintf(FERROR,"remote rsync does not support include syntax - aborting\n"); - exit_cleanup(1); + exit_cleanup(RERR_UNSUPPORTED); } write_int(f,l+2); write_buf(f,"+ ",2); @@ -301,6 +301,17 @@ void add_exclude_line(char *p) free(p); } +void add_include_line(char *p) +{ + char *tok; + if (!p || !*p) return; + p = strdup(p); + if (!p) out_of_memory("add_include_line"); + for (tok=strtok(p," "); tok; tok=strtok(NULL," ")) + add_exclude(tok, 1); + free(p); +} + static char *cvs_ignore_list[] = { "RCS","SCCS","CVS","CVS.adm","RCSLOG","cvslog.*", @@ -321,7 +332,7 @@ void add_cvs_excludes(void) add_exclude(cvs_ignore_list[i], 0); if ((p=getenv("HOME")) && strlen(p) < (MAXPATHLEN-12)) { - slprintf(fname,sizeof(fname)-1, "%s/.cvsignore",p); + slprintf(fname,sizeof(fname), "%s/.cvsignore",p); add_exclude_file(fname,0,0); }