diff options
author | Rob Landley <rob@landley.net> | 2016-08-13 15:19:29 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-08-13 15:19:29 -0500 |
commit | bc1ccaccb5b7ec71775a5eb7e529bb93811956ce (patch) | |
tree | b2b5b4015176a972cb6edd3ac6dc93651138e77c /toys | |
parent | 4460e9f0ed16a3f4dea4dec13f90df9c956b4dc9 (diff) | |
download | toybox-bc1ccaccb5b7ec71775a5eb7e529bb93811956ce.tar.gz |
Move getusername/getgroupname to lib. (Return name or string representation
of number, but never NULL. Both returned in static buffer good through
next call.)
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/ls.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/toys/posix/ls.c b/toys/posix/ls.c index 3ad28da4..d48fb831 100644 --- a/toys/posix/ls.c +++ b/toys/posix/ls.c @@ -61,7 +61,7 @@ GLOBALS( unsigned screen_width; int nl_title; - char uid_buf[12], gid_buf[12], *escmore; + char *escmore; ) // Callback from crunch_str to represent unprintable chars @@ -121,22 +121,6 @@ static char endtype(struct stat *st) return 0; } -static char *getusername(uid_t uid) -{ - struct passwd *pw = bufgetpwuid(uid); - - sprintf(TT.uid_buf, "%u", (unsigned)uid); - return pw ? pw->pw_name : TT.uid_buf; -} - -static char *getgroupname(gid_t gid) -{ - struct group *gr = bufgetgrgid(gid); - - sprintf(TT.gid_buf, "%u", (unsigned)gid); - return gr ? gr->gr_name : TT.gid_buf; -} - static int numlen(long long ll) { return snprintf(0, 0, "%llu", ll); |