# HG changeset patch # User John Tsiombikas # Date 1323171932 -7200 # Node ID 8b92b0c1c220755d588187f71ef9675c1734f7a9 # Parent 9c979413cfbfc72aa784ab8a98972e250be12a59 added decimal digits to the disk size output diff -r 9c979413cfbf -r 8b92b0c1c220 src/ata.c --- a/src/ata.c Tue Dec 06 13:37:11 2011 +0200 +++ b/src/ata.c Tue Dec 06 13:45:32 2011 +0200 @@ -245,14 +245,16 @@ { static const char *suffix[] = {"kb", "mb", "gb", "tb", "pb", 0}; int i; + unsigned int rem; /* start with kilobytes */ nsect /= 2; for(i=0; nsect >= 1024 && suffix[i + 1]; i++) { + rem = nsect % 1024; nsect /= 1024; } - sprintf(buf, "%u%s", (unsigned int)nsect, suffix[i]); + sprintf(buf, "%u.%u%s", (unsigned int)nsect, 100 * rem / 1024, suffix[i]); return buf; }