aboutsummaryrefslogtreecommitdiff
path: root/coreutils/id.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-12-02 22:56:59 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-12-02 22:56:59 +0000
commit0c68a874e7d996c62c8d00b0c0289180bdce1590 (patch)
tree57a06bc9317dd24ccf417874c2ecfb10b056adb2 /coreutils/id.c
parentb6ddee242592ffd02c05ae3ed6127c1dd80d7580 (diff)
downloadbusybox-w32-0c68a874e7d996c62c8d00b0c0289180bdce1590.tar.gz
busybox-w32-0c68a874e7d996c62c8d00b0c0289180bdce1590.tar.bz2
busybox-w32-0c68a874e7d996c62c8d00b0c0289180bdce1590.zip
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
Diffstat (limited to 'coreutils/id.c')
-rw-r--r--coreutils/id.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/coreutils/id.c b/coreutils/id.c
index 6ddb23666..33e06f427 100644
--- a/coreutils/id.c
+++ b/coreutils/id.c
@@ -36,12 +36,8 @@ enum {
36#endif 36#endif
37}; 37};
38 38
39static int print_common(unsigned id, 39static int print_common(unsigned id, const char *name, const char *prefix)
40 char* FAST_FUNC bb_getXXXid(char *name, int bufsize, long uid),
41 const char *prefix)
42{ 40{
43 const char *name = bb_getXXXid(NULL, 0, id);
44
45 if (prefix) { 41 if (prefix) {
46 printf("%s", prefix); 42 printf("%s", prefix);
47 } 43 }
@@ -65,12 +61,12 @@ static int print_common(unsigned id,
65 61
66static int print_group(gid_t id, const char *prefix) 62static int print_group(gid_t id, const char *prefix)
67{ 63{
68 return print_common(id, bb_getgrgid, prefix); 64 return print_common(id, gid2group(id), prefix);
69} 65}
70 66
71static int print_user(uid_t id, const char *prefix) 67static int print_user(uid_t id, const char *prefix)
72{ 68{
73 return print_common(id, bb_getpwuid, prefix); 69 return print_common(id, uid2uname(id), prefix);
74} 70}
75 71
76/* On error set *n < 0 and return >= 0 72/* On error set *n < 0 and return >= 0