Improved the SUBPROTOCOL_VERSION code a little, and bumped the value
[rsync/rsync.git] / options.c
index 98c6e4d..f860a49 100644 (file)
--- a/options.c
+++ b/options.c
@@ -198,6 +198,7 @@ char *bind_address;
 
 static void print_rsync_version(enum logcode f)
 {
+       char *subprotocol = "";
        char const *got_socketpair = "no ";
        char const *have_inplace = "no ";
        char const *hardlinks = "no ";
@@ -207,18 +208,18 @@ static void print_rsync_version(enum logcode f)
        char const *ipv6 = "no ";
        STRUCT_STAT *dumstat;
 
+#if SUBPROTOCOL_VERSION != 0
+       asprintf(&subprotocol, ".PR%d", SUBPROTOCOL_VERSION);
+#endif
 #ifdef HAVE_SOCKETPAIR
        got_socketpair = "";
 #endif
-
 #ifdef HAVE_FTRUNCATE
        have_inplace = "";
 #endif
-
 #ifdef SUPPORT_HARD_LINKS
        hardlinks = "";
 #endif
-
 #ifdef SUPPORT_ACLS
        acls = "";
 #endif
@@ -228,16 +229,16 @@ static void print_rsync_version(enum logcode f)
 #ifdef SUPPORT_LINKS
        links = "";
 #endif
-
 #ifdef INET6
        ipv6 = "";
 #endif
 
-       rprintf(f, "%s  version %s  protocol version %d\n",
-               RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION);
+       rprintf(f, "%s  version %s  protocol version %d%s\n",
+               RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
        rprintf(f, "Copyright (C) 1996-2007 by Andrew Tridgell, Wayne Davison, and others.\n");
-       rprintf(f, "<http://rsync.samba.org/>\n");
-       rprintf(f, "Capabilities: %d-bit files, %d-bit inums, %d-bit timestamps, %d-bit long ints,\n",
+       rprintf(f, "Web site: http://rsync.samba.org/\n");
+       rprintf(f, "Capabilities:\n");
+       rprintf(f, "    %d-bit files, %d-bit inums, %d-bit timestamps, %d-bit long ints,\n",
                (int)(sizeof (OFF_T) * 8),
                (int)(sizeof dumstat->st_ino * 8), /* Don't check ino_t! */
                (int)(sizeof (time_t) * 8),
@@ -1644,6 +1645,15 @@ void server_options(char **args,int *argc)
 
        argstr[x] = '\0';
 
+#if SUBPROTOCOL_VERSION != 0
+       /* If we're speaking a pre-release version of a protocol, we tell
+        * the server about this by (ab)using the -e option. */
+       if (protocol_version == PROTOCOL_VERSION) {
+               x += snprintf(argstr+x, sizeof argstr - x,
+                             "e%d.%d", PROTOCOL_VERSION, SUBPROTOCOL_VERSION);
+       }
+#endif
+
        if (x != 1)
                args[ac++] = argstr;