rem: if (ent->match_flags & MATCHFLG_PERDIR_MERGE) { char buf[MAX_RULE_PREFIX], *op = buf; if (protocol_version < 29) { rprintf(FERROR, "remote rsync is too old to understand per-directory merge files.\n"); exit_cleanup(RERR_SYNTAX); } *op++ = ':'; if (ent->match_flags & MATCHFLG_WORD_SPLIT) *op++ = 's'; if (ent->match_flags & MATCHFLG_NO_INHERIT) *op++ = 'n'; if (ent->match_flags & MATCHFLG_EXCLUDE_SELF) *op++ = 'e'; if (ent->match_flags & MATCHFLG_NO_PREFIXES) { if (ent->match_flags & MATCHFLG_INCLUDE) *op++ = '+'; else *op++ = '-'; } *op++ = ' '; if (op - buf > MAX_RULE_PREFIX) overflow("send_filter_list"); write_int(f, l + (op - buf)); write_buf(f, buf, op - buf); } else if (ent->match_flags & MATCHFLG_INCLUDE) { write_int(f, l + 2); write_buf(f, "+ ", 2); } else if (protocol_version >= 29 || ((*p == '-' || *p == '+') && p[1] == ' ')) { write_int(f, l + 2); write_buf(f, "- ", 2); } else write_int(f, l); write_buf(f, p, l);
add: dlen = ent->match_flags & MATCHFLG_DIRECTORY ? 1 : 0; write_int(f, plen + len + dlen); if (plen) write_buf(f, p, plen); write_buf(f, ent->pattern, len); if (dlen) write_byte(f, '/');
context: void send_filter_list(int f){	struct filter_struct *ent;	/* This is a complete hack - blame Rusty.  FIXME!	 * Remove this hack when older rsyncs (below 2.6.4) are gone. */	if (list_only == 1 && !recurse)		add_filter(&filter_list, "/*/*", XFLG_DEF_EXCLUDE);	for (ent = filter_list.head; ent; ent = ent->next) {		unsigned int l;		char p[MAXPATHLEN+MAX_RULE_PREFIX+1];		l = strlcpy(p, ent->pattern, sizeof p);		if (l == 0 || l >= MAXPATHLEN)			continue;		if (ent->match_flags & MATCHFLG_DIRECTORY) {			p[l++] = '/';			p[l] = '\0';		}		if (ent->match_flags & MATCHFLG_PERDIR_MERGE) {			char buf[MAX_RULE_PREFIX], *op = buf;			if (protocol_version < 29) {				rprintf(FERROR,					"remote rsync is too old to understand per-directory merge files.\n");				exit_cleanup(RERR_SYNTAX);			}			*op++ = ':';			if (ent->match_flags & MATCHFLG_WORD_SPLIT)				*op++ = 's';			if (ent->match_flags & MATCHFLG_NO_INHERIT)				*op++ = 'n';			if (ent->match_flags & MATCHFLG_EXCLUDE_SELF)				*op++ = 'e';			if (ent->match_flags & MATCHFLG_NO_PREFIXES) {				if (ent->match_flags & MATCHFLG_INCLUDE)					*op++ = '+';				else					*op++ = '-';			}			*op++ = ' ';			if (op - buf > MAX_RULE_PREFIX)				overflow("send_filter_list");			write_int(f, l + (op - buf));			write_buf(f, buf, op - buf);		} else if (ent->match_flags & MATCHFLG_INCLUDE) {			write_int(f, l + 2);			write_buf(f, "+ ", 2);		} else if (protocol_version >= 29		    || ((*p == '-' || *p == '+') && p[1] == ' ')) {			write_int(f, l + 2);			write_buf(f, "- ", 2);		} else			write_int(f, l);		write_buf(f, p, l);	}	write_int(f, 0);}