ls fix: d flag

This commit is contained in:
Your Name 2023-11-30 10:32:18 +03:00
parent 369f3af147
commit 1301d3f5ef
1 changed files with 4 additions and 5 deletions

View File

@ -151,7 +151,9 @@ int print(const struct d_node *node) {
char ind = '-';
char *color = "";
if (S_ISDIR(node->stats.st_mode)) {
suf = '/';
if (node->name[strlen(node->name) - 1] != '/')
suf = '/';
ind = 'd';
color = LS_DIR_COLOR;
}
@ -220,10 +222,7 @@ void col_print(struct d_node **node, size_t files, struct winsize w) {
maxlen = strlen(node[i]->name);
/* Calc */
maxlen += 2;
if (F_flag)
maxlen++;
maxlen += 3;
size_t ncols = w.ws_col / maxlen;
size_t nrows = files;
if (ncols > 1) {