diff options
author | Wayne Davison <wayned@samba.org> | 2008-09-01 12:53:43 -0700 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2008-09-01 13:27:11 -0700 |
commit | adc2476fa213797d849ae80fa8b5fcd9eba5dc4f (patch) | |
tree | 6a2ec090dfab190c8583760edafb2828cd7f4944 /tls.c | |
parent | 34c3ca8f35ddd77eb18711d227924d0010520075 (diff) | |
download | rsync-adc2476fa213797d849ae80fa8b5fcd9eba5dc4f.tar.gz rsync-adc2476fa213797d849ae80fa8b5fcd9eba5dc4f.tar.bz2 rsync-adc2476fa213797d849ae80fa8b5fcd9eba5dc4f.zip |
Output numbers in 3-digit groups by default (e.g. 1,234,567).
Also improved the human-readable output functions, including
adding the ability to output negative numbers.
Diffstat (limited to 'tls.c')
-rw-r--r-- | tls.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -49,6 +49,7 @@ int link_times = 0; int link_owner = 0; int preserve_perms = 0; int preserve_executability = 0; +char number_separator; #ifdef SUPPORT_XATTRS @@ -180,7 +181,7 @@ static void list_file(const char *fname) (long)major(buf.st_rdev), (long)minor(buf.st_rdev)); } else - printf("%12s", big_num(buf.st_size, 0)); + printf("%15s", do_big_num(buf.st_size, 1, NULL)); printf(" %6ld.%-6ld %6ld %s %s%s\n", (long)buf.st_uid, (long)buf.st_gid, (long)buf.st_nlink, datebuf, fname, linkbuf); @@ -217,6 +218,7 @@ main(int argc, char *argv[]) { poptContext pc; const char **extra_args; + char buf[32]; int opt; pc = poptGetContext(PROGRAM, argc, (const char **)argv, @@ -238,6 +240,12 @@ 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); |