Set number_separator the first time it gets used.
authorWayne Davison <wayned@samba.org>
Tue, 11 Jun 2013 20:28:45 +0000 (13:28 -0700)
committerWayne Davison <wayned@samba.org>
Tue, 11 Jun 2013 20:28:45 +0000 (13:28 -0700)
lib/compat.c
options.c
t_stub.c
tls.c
trimslash.c
wildtest.c

index f756f76d6b6dd82333200e6748c171e80eb17fd8..b89ef02e0e167cc3f0ecb94a9554d3802f6bd35b 100644 (file)
@@ -22,7 +22,7 @@
 #include "rsync.h"
 #include "itypes.h"
 
-extern char number_separator;
+static char number_separator;
 
 #ifndef HAVE_STRDUP
  char *strdup(char *s)
@@ -190,6 +190,15 @@ char *do_big_num(int64 num, int human_flag, const char *fract)
        char *s;
        int len, negated;
 
+       if (human_flag && !number_separator) {
+               char buf[32];
+               snprintf(buf, sizeof buf, "%f", 3.14);
+               if (strchr(buf, '.') != NULL)
+                       number_separator = ',';
+               else
+                       number_separator = '.';
+       }
+
        n = (n + 1) % (sizeof bufs / sizeof bufs[0]);
 
        if (human_flag > 1) {
index 91e3fdd54552ab7127b88e0056df86b7f3c5afc1..cebf25691e121ac485d8b11bec1f14355d1f6e07 100644 (file)
--- a/options.c
+++ b/options.c
@@ -123,7 +123,6 @@ int checksum_seed = 0;
 int inplace = 0;
 int delay_updates = 0;
 long block_size = 0; /* "long" because popt can't set an int32. */
-char number_separator;
 char *skip_compress = NULL;
 item_list dparam_list = EMPTY_ITEM_LIST;
 
@@ -1870,15 +1869,6 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                        verbose > 1 ? "stats3" : "stats2", DEFAULT_PRIORITY);
        }
 
-       if (human_readable) {
-               char buf[32];
-               snprintf(buf, sizeof buf, "%f", 3.14);
-               if (strchr(buf, '.') != NULL)
-                       number_separator = ',';
-               else
-                       number_separator = '.';
-       }
-
 #ifdef ICONV_OPTION
        if (iconv_opt && protect_args != 2) {
                if (!am_server && strcmp(iconv_opt, "-") == 0)
index 013c09d156587a7652740b123f8ed569eada28f9..0fca865951feec75b3aad4015d2ff262a8d9af19 100644 (file)
--- a/t_stub.c
+++ b/t_stub.c
@@ -30,7 +30,6 @@ int module_dirlen = 0;
 int preserve_acls = 0;
 int preserve_times = 0;
 int preserve_xattrs = 0;
-char number_separator = ',';
 char *partial_dir;
 char *module_dir;
 filter_rule_list daemon_filter_list;
diff --git a/tls.c b/tls.c
index f111c02e50d2925a4a611cdeb860cb4cf37edac9..b84085d7985304a966920a2e34df06f57e801cff 100644 (file)
--- a/tls.c
+++ b/tls.c
@@ -51,7 +51,6 @@ int link_owner = 0;
 int nsec_times = 0;
 int preserve_perms = 0;
 int preserve_executability = 0;
-char number_separator;
 
 #ifdef SUPPORT_XATTRS
 
@@ -255,12 +254,6 @@ main(int argc, char *argv[])
        if (!extra_args || *extra_args == NULL)
                tls_usage(1);
 
-       snprintf(buf, sizeof buf, "%f", 3.14);
-       if (strchr(buf, '.') != NULL)
-               number_separator = ',';
-       else
-               number_separator = '.';
-
        for (; *extra_args; extra_args++)
                list_file(*extra_args);
        poptFreeContext(pc);
index 448064ab2f9d87bd88045b05f59030fc097b281d..7694eb1ed480728e7e3712d262ca41d6ae5b6883 100644 (file)
@@ -28,7 +28,6 @@ int read_only = 1;
 int list_only = 0;
 int preserve_perms = 0;
 int preserve_executability = 0;
-char number_separator = ',';
 
 int
 main(int argc, char **argv)
index 10534e01e8d65f977e93f8f71f056a4e006c33cb..2621c15b8114651ce01bd4ba603bc93799a6534d 100644 (file)
@@ -31,7 +31,6 @@ int fnmatch_errors = 0;
 #endif
 
 int wildmatch_errors = 0;
-char number_separator = ',';
 
 typedef char bool;