libbb: password/group function helpers rewritten by Tito:
function old new delta
xgetpwuid - 27 +27
uid2uname_utoa - 22 +22
gid2group_utoa - 22 +22
uid2uname - 18 +18
gid2group - 18 +18
buffer_fill_and_print 179 196 +17
print_user 12 24 +12
print_group 12 24 +12
get_cached 89 99 +10
...
print_common 134 120 -14
vlock_main 415 396 -19
logger_main 410 387 -23
crontab_main 642 609 -33
bb_getpwuid 42 - -42
bb_getgrgid 42 - -42
bb_getug 80 - -80
------------------------------------------------------------------------------
(add/remove: 6/3 grow/shrink: 9/11 up/down: 187/-296) Total: -109 bytes
diff --git a/include/libbb.h b/include/libbb.h
index e4ccc75..acae93a 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -702,14 +702,14 @@
void xget_uidgid(struct bb_uidgid_t*, const char*) FAST_FUNC;
/* chown-like handling of "user[:[group]" */
void parse_chown_usergroup_or_die(struct bb_uidgid_t *u, char *user_group) FAST_FUNC;
-/* bb_getpwuid, bb_getgrgid:
- * bb_getXXXid(buf, bufsz, id) - copy user/group name or id
- * as a string to buf, return user/group name or NULL
- * bb_getXXXid(NULL, 0, id) - return user/group name or NULL
- * bb_getXXXid(NULL, -1, id) - return user/group name or exit
-*/
-char *bb_getpwuid(char *name, int bufsize, long uid) FAST_FUNC;
-char *bb_getgrgid(char *group, int bufsize, long gid) FAST_FUNC;
+struct passwd* xgetpwuid(uid_t uid) FAST_FUNC;
+struct group* xgetgrgid(gid_t gid) FAST_FUNC;
+char* xuid2uname(uid_t uid) FAST_FUNC;
+char* xgid2group(gid_t gid) FAST_FUNC;
+char* uid2uname(uid_t uid) FAST_FUNC;
+char* gid2group(gid_t gid) FAST_FUNC;
+char* uid2uname_utoa(long uid) FAST_FUNC;
+char* gid2group_utoa(long gid) FAST_FUNC;
/* versions which cache results (useful for ps, ls etc) */
const char* get_cached_username(uid_t uid) FAST_FUNC;
const char* get_cached_groupname(gid_t gid) FAST_FUNC;