better file size format

This commit is contained in:
Night Kaly 2024-03-13 23:59:08 +00:00
parent 5c3c0bf07f
commit 071961befa
No known key found for this signature in database
GPG key ID: 8E829D3381CFEBBE

3
ccc.c
View file

@ -306,7 +306,8 @@ long add_file_stat(char *filepath)
bytes /= 1024; bytes /= 1024;
unit++; unit++;
} }
sprintf(size, "%.*f%s", unit, bytes, units[unit]); /* 4 sig fig, limiting characters to have better format */
sprintf(size, "%-6.4g %-3s", bytes, units[unit]);
/* get file type */ /* get file type */
char *type = memalloc(4 * sizeof(char)); /* 3 chars for type */ char *type = memalloc(4 * sizeof(char)); /* 3 chars for type */