summaryrefslogtreecommitdiff
path: root/coreutils/ls.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-01-19 21:24:17 +0000
committerDenis Vlasenko2007-01-19 21:24:17 +0000
commit2405ad659e2596b17c88e7b950c086159d06cc6e (patch)
tree35b7039cf3d4fab57d1e4c69cc0bea5bc847a832 /coreutils/ls.c
parent9af7c9d6b62ceb07a9ba24cee0cf4a08c689235e (diff)
downloadbusybox-2405ad659e2596b17c88e7b950c086159d06cc6e.zip
busybox-2405ad659e2596b17c88e7b950c086159d06cc6e.tar.gz
ls: use get_cached_username/groupname
Diffstat (limited to 'coreutils/ls.c')
-rw-r--r--coreutils/ls.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index ae28f64..ff0831d 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -291,7 +291,7 @@ static void dfree(struct dnode **dnp, int nfiles)
free(dnp); /* free the array holding the dnode pointers */
}
#else
-#define dfree(...) do {} while (0)
+#define dfree(...) ((void)0)
#endif
static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which)
@@ -375,7 +375,7 @@ static void dnsort(struct dnode **dn, int size)
qsort(dn, size, sizeof(*dn), sortcmp);
}
#else
-#define dnsort(dn, size) do {} while (0)
+#define dnsort(dn, size) ((void)0)
#endif
@@ -541,9 +541,6 @@ static int list_single(struct dnode *dn)
{
int i, column = 0;
-#if ENABLE_FEATURE_LS_USERNAME
- char scratch[16];
-#endif
#if ENABLE_FEATURE_LS_TIMESTAMPS
char *filetime;
time_t ttime, age;
@@ -584,10 +581,9 @@ static int list_single(struct dnode *dn)
break;
case LIST_ID_NAME:
#if ENABLE_FEATURE_LS_USERNAME
- bb_getpwuid(scratch, dn->dstat.st_uid, sizeof(scratch));
- printf("%-8.8s ", scratch);
- bb_getgrgid(scratch, dn->dstat.st_gid, sizeof(scratch));
- printf("%-8.8s", scratch);
+ printf("%-8.8s %-8.8s",
+ get_cached_username(dn->dstat.st_uid),
+ get_cached_groupname(dn->dstat.st_gid));
column += 17;
break;
#endif