Require -VV to see SIMD & ASM in version output
authorWayne Davison <wayne@opencoder.net>
Sun, 21 Jun 2020 02:42:14 +0000 (19:42 -0700)
committerWayne Davison <wayne@opencoder.net>
Sun, 21 Jun 2020 02:57:11 +0000 (19:57 -0700)
options.c

index 2e8731abce5a19771eced9c0e7ccef1e04ff2220..3fee6691158d42da3a8f9b4fa350e24dd91e7b37 100644 (file)
--- a/options.c
+++ b/options.c
@@ -180,6 +180,7 @@ int rsync_port = 0;
 int alt_dest_type = 0;
 int basis_dir_cnt = 0;
 
+static int version_opt_cnt = 0;
 static int remote_option_alloc = 0;
 int remote_option_cnt = 0;
 const char **remote_options = NULL;
@@ -582,6 +583,18 @@ static void print_capabilities(enum logcode f)
                istring("%d-bit timestamps", (int)(sizeof (time_t) * 8)),
                istring("%d-bit long ints", (int)(sizeof (int64) * 8)),
 
+       "*"
+#ifndef HAVE_SIMD
+               "no "
+#endif
+                       "SIMD",
+
+       "*"
+#ifndef HAVE_ASM
+               "no "
+#endif
+                       "ASM",
+
 #ifndef HAVE_SOCKETPAIR
                "no "
 #endif
@@ -639,11 +652,6 @@ static void print_capabilities(enum logcode f)
 #endif
                        "prealloc",
 
-#ifndef HAVE_SIMD
-               "no "
-#endif
-                       "SIMD",
-
                NULL
        };
 
@@ -651,6 +659,12 @@ static void print_capabilities(enum logcode f)
                char *cap = capabilities[j];
                int cap_len = cap ? strlen(cap) : 1000;
                int need_comma = cap && capabilities[j+1] != NULL ? 1 : 0;
+               if (cap && *cap == '*') {
+                       if (version_opt_cnt < 2)
+                               continue;
+                       cap++;
+                       cap_len--;
+               }
                if (line_len + 1 + cap_len + need_comma >= (int)sizeof line_buf) {
                        rprintf(f, "   %s\n", line_buf);
                        line_len = 0;
@@ -1361,8 +1375,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
 
                switch (opt) {
                case 'V':
-                       print_rsync_version(FINFO);
-                       exit_cleanup(0);
+                       version_opt_cnt++;
+                       break;
 
                case OPT_SERVER:
                        if (!am_server) {
@@ -1848,6 +1862,11 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                }
        }
 
+       if (version_opt_cnt) {
+               print_rsync_version(FINFO);
+               exit_cleanup(0);
+       }
+
        if (protect_args < 0) {
                if (am_server)
                        protect_args = 0;