Minor refactor

This commit is contained in:
Arun Prakash Jana 2021-04-11 04:15:13 +05:30
parent ee04215d91
commit 0c55e74fb5
No known key found for this signature in database
GPG Key ID: A75979F35C080412
1 changed files with 4 additions and 6 deletions

View File

@ -3715,20 +3715,18 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
static void print_details(const struct entry *ent) static void print_details(const struct entry *ent)
{ {
int entry_type = ent->mode & S_IFMT; int entry_type = ent->mode & S_IFMT;
char perms[6] = {' ', ' ', (char)('0' + ((ent->mode >> 6) & 7)),
(char)('0' + ((ent->mode >> 3) & 7)), (char)('0' + (ent->mode & 7)), '\0'};
/* Directories are always shown on top */ /* Directories are always shown on top */
resetdircolor(ent->flags); resetdircolor(ent->flags);
print_time(&ent->t); print_time(&ent->t);
addstr(" "); addstr(perms);
/* Permissions */
addch('0' + ((ent->mode >> 6) & 7));
addch('0' + ((ent->mode >> 3) & 7));
addch('0' + (ent->mode & 7));
if (entry_type == S_IFREG || entry_type == S_IFDIR) { if (entry_type == S_IFREG || entry_type == S_IFDIR) {
char *size = coolsize(cfg.blkorder ? ent->blocks << blk_shift : ent->size); char *size = coolsize(cfg.blkorder ? ent->blocks << blk_shift : ent->size);
printw("%*c%s", 9 - (uint_t)xstrlen(size), ' ', size); printw("%*c%s", 9 - (uint_t)xstrlen(size), ' ', size);
} else } else
printw("%*c%c", 8, ' ', get_detail_ind(ent->mode)); printw("%*c%c", 8, ' ', get_detail_ind(ent->mode));