ls: improve default format

truncate username and group for better alignment for now. in the future
better tabular printing will be implemented.
This commit is contained in:
Hiltjo Posthuma 2014-07-21 13:42:33 +00:00 committed by sin
parent 81bb8422a5
commit 35959cd1c4

2
ls.c
View File

@ -282,7 +282,7 @@ output(Entry *ent)
fmt = "%b %d %H:%M"; fmt = "%b %d %H:%M";
strftime(buf, sizeof buf, fmt, localtime(&ent->mtime)); strftime(buf, sizeof buf, fmt, localtime(&ent->mtime));
printf("%s %2ld %-4s %-5s %6lu %s %s%s", mode, (long)ent->nlink, pwname, printf("%s %4ld %-8.8s %-8.8s %10lu %s %s%s", mode, (long)ent->nlink, pwname,
grname, (unsigned long)ent->size, buf, ent->name, indicator(ent->mode)); grname, (unsigned long)ent->size, buf, ent->name, indicator(ent->mode));
if(S_ISLNK(ent->mode)) { if(S_ISLNK(ent->mode)) {
if((len = readlink(ent->name, buf, sizeof buf)) == -1) if((len = readlink(ent->name, buf, sizeof buf)) == -1)