+extern int protect_args;
+extern int preserve_uid;
+extern int preserve_gid;
+extern int preserve_acls;
+extern int preserve_xattrs;
+extern int need_messages_from_generator;
+extern int delete_mode, delete_before, delete_during, delete_after;
+extern char *shell_cmd;
+extern char *partial_dir;
+extern char *dest_option;
+extern char *files_from;
+extern char *filesfrom_host;
+extern struct filter_list_struct filter_list;
+extern int need_unsorted_flist;
+#ifdef ICONV_OPTION
+extern iconv_t ic_send, ic_recv;
+#endif
+
+/* These index values are for the file-list's extra-attribute array. */
+int uid_ndx, gid_ndx, acls_ndx, xattrs_ndx, unsort_ndx;
+
+int receiver_symlink_times = 0; /* receiver can set the time on a symlink */
+
+#ifdef ICONV_OPTION
+int filesfrom_convert = 0;
+#endif
+
+#define CF_INC_RECURSE (1<<0)
+#define CF_SYMLINK_TIMES (1<<1)
+
+static const char *client_info;
+
+/* The server makes sure that if either side only supports a pre-release
+ * version of a protocol, that both sides must speak a compatible version
+ * of that protocol for it to be advertised as available. */
+static void check_sub_protocol(void)
+{
+ char *dot;
+ int their_protocol, their_sub;
+#if SUBPROTOCOL_VERSION != 0
+ int our_sub = protocol_version < PROTOCOL_VERSION ? 0 : SUBPROTOCOL_VERSION;
+#else
+ int our_sub = 0;
+#endif
+
+ /* client_info starts with VER.SUB string if client is a pre-release. */
+ if (!(their_protocol = atoi(client_info))
+ || !(dot = strchr(client_info, '.'))
+ || !(their_sub = atoi(dot+1))) {
+#if SUBPROTOCOL_VERSION != 0
+ if (our_sub)
+ protocol_version--;
+#endif
+ return;
+ }
+
+ if (their_protocol < protocol_version) {
+ if (their_sub)
+ protocol_version = their_protocol - 1;
+ return;
+ }
+
+ if (their_protocol > protocol_version)
+ their_sub = 0; /* 0 == final version of older protocol */
+ if (their_sub != our_sub)
+ protocol_version--;
+}
+
+void set_allow_inc_recurse(void)
+{
+ client_info = shell_cmd ? shell_cmd : "";
+
+ if (!recurse || use_qsort)
+ allow_inc_recurse = 0;
+ else if (!am_sender
+ && (delete_before || delete_after
+ || delay_updates || prune_empty_dirs))
+ allow_inc_recurse = 0;
+ else if (am_server && !local_server
+ && (strchr(client_info, 'i') == NULL))
+ allow_inc_recurse = 0;
+}