Patch bass ackwards behavior of hr flag.
This commit is contained in:
parent
7cd0cfeab6
commit
d98e574d41
@ -201,7 +201,7 @@ struct sysinfo {
|
||||
};
|
||||
extern int sysinfo (struct sysinfo* info);
|
||||
|
||||
const char *make_human_readable_str(unsigned long val, unsigned long hr);
|
||||
const char *make_human_readable_str(unsigned long val, unsigned long not_hr);
|
||||
enum {
|
||||
KILOBYTE = 1024,
|
||||
MEGABYTE = (KILOBYTE*1024),
|
||||
|
@ -31,10 +31,13 @@
|
||||
static char buffer[10];
|
||||
static const char *suffixes[] = { "", "k", "M", "G", "T" };
|
||||
|
||||
const char *make_human_readable_str(unsigned long val, unsigned long hr)
|
||||
const char *make_human_readable_str(unsigned long val, unsigned long not_hr)
|
||||
{
|
||||
int suffix, base;
|
||||
|
||||
if (not_hr)
|
||||
sprintf(buffer, "%lu", val);
|
||||
else
|
||||
for (suffix = 0, base = 1; suffix < 5; suffix++, base <<= 10) {
|
||||
if (val < (base << 10)) {
|
||||
if (suffix && val < 10 * base)
|
||||
|
@ -201,7 +201,7 @@ struct sysinfo {
|
||||
};
|
||||
extern int sysinfo (struct sysinfo* info);
|
||||
|
||||
const char *make_human_readable_str(unsigned long val, unsigned long hr);
|
||||
const char *make_human_readable_str(unsigned long val, unsigned long not_hr);
|
||||
enum {
|
||||
KILOBYTE = 1024,
|
||||
MEGABYTE = (KILOBYTE*1024),
|
||||
|
Loading…
Reference in New Issue
Block a user