commit ddca21290abf5f18a0ece0af679320c330c70e74 from: Marcel Rodrigues date: Thu Apr 23 15:12:38 2015 UTC Show fractional part of size when unit is not bytes. commit - 165b8d9e451e266d433dd43c4952d78fb371c7c2 commit + ddca21290abf5f18a0ece0af679320c330c70e74 blob - 8b3e07622f60be25214d6911d182697f42d2794a blob + efacfe9d63b20d419939d7de80dc3c8e6760f29c --- rover.c +++ rover.c @@ -325,13 +325,18 @@ update_view() else wcolor_set(rover.window, RVC_FILE, NULL); if (!isdir) { - char *human_suffix, *suffixes = "BKMGTPEZY"; - off_t human_size = ESIZE(j); - for (human_suffix = suffixes; human_size >= 1024; human_suffix++) + char *suffix, *suffixes = "BKMGTPEZY"; + off_t human_size = ESIZE(j) * 10; + for (suffix = suffixes; human_size >= 10240; suffix++) human_size = (human_size + 512) / 1024; - snprintf(ROW, ROWSZ, "%s%*d %c", ENAME(j), - (int) (COLS - strlen(ENAME(j)) - 6), - (int) human_size, *human_suffix); + if (*suffix == 'B') + snprintf(ROW, ROWSZ, "%s%*d %c", ENAME(j), + (int) (COLS - strlen(ENAME(j)) - 6), + (int) human_size / 10, *suffix); + else + snprintf(ROW, ROWSZ, "%s%*d.%d %c", ENAME(j), + (int) (COLS - strlen(ENAME(j)) - 8), + (int) human_size / 10, (int) human_size % 10, *suffix); } else strcpy(ROW, ENAME(j)); mvwhline(rover.window, i + 1, 1, ' ', COLS - 2);