Skip to content

Commit 0ca5744

Browse files
committed
human-readable: add an "i" to unit to indicate binary (1024) base
1 parent f4df40e commit 0ca5744

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/compat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ char *do_big_num(int64 num, int human_flag, const char *fract)
206206
break;
207207
}
208208

209-
snprintf(bufs[n], sizeof bufs[0], "%.*f%c", precision,
210-
(double) num / powi, *units);
209+
snprintf(bufs[n], sizeof bufs[0], "%.*f%c%s", precision,
210+
(double) num / powi, *units, num > mult && mult == 1024 ? "i" : "");
211211
return bufs[n];
212212
}
213213

rsync.1.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3312,6 +3312,8 @@ expand it.
33123312
(mega), `G` (giga), `T` (tera), `P` (peta), `E` (exa), `Z` (zetta) or `Y`
33133313
(yotta). For example, a 1234567-byte file would output as 1.23M in level-2
33143314
(assuming that a period is your local decimal point).
3315+
Additionally an `i` is appended in level-3 to indicate the binary base.
3316+
The same file would output as 1.17Mi in level-3.
33153317

33163318
Backward compatibility note: versions of rsync prior to 3.1.0 do not
33173319
support human-readable level 1, and they default to level 0. Thus,

0 commit comments

Comments
 (0)