+#ifdef ICONV_OPTION
+extern char *iconv_opt;
+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;
+#ifdef ICONV_OPTION
+int ic_ndx;
+
+int filesfrom_convert = 0;
+#endif
+
+/* 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
+
+ if (!shell_cmd || !(dot = strchr(shell_cmd, '.'))
+ || !(their_protocol = atoi(shell_cmd))
+ || !(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--;
+}