diff options
Diffstat (limited to 'libbb/bb_pwd.c')
-rw-r--r-- | libbb/bb_pwd.c | 46 |
1 files changed, 4 insertions, 42 deletions
diff --git a/libbb/bb_pwd.c b/libbb/bb_pwd.c index e4d327340..3a214ca33 100644 --- a/libbb/bb_pwd.c +++ b/libbb/bb_pwd.c | |||
@@ -7,8 +7,11 @@ | |||
7 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | 7 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <stdio.h> | ||
11 | #include <string.h> | ||
12 | #include <assert.h> | ||
13 | #include "libbb.h" | ||
10 | 14 | ||
11 | #ifdef L_bb_getgrgid | ||
12 | /* Hacked by Tito Ragusa (c) 2004 <farmatito@tiscali.it> to make it more | 15 | /* Hacked by Tito Ragusa (c) 2004 <farmatito@tiscali.it> to make it more |
13 | * flexible : | 16 | * flexible : |
14 | * | 17 | * |
@@ -26,9 +29,6 @@ | |||
26 | * the program exits. | 29 | * the program exits. |
27 | */ | 30 | */ |
28 | 31 | ||
29 | #include "libbb.h" | ||
30 | #include "grp_.h" | ||
31 | |||
32 | /* gets a groupname given a gid */ | 32 | /* gets a groupname given a gid */ |
33 | char * bb_getgrgid(char *group, long gid, int bufsize) | 33 | char * bb_getgrgid(char *group, long gid, int bufsize) |
34 | { | 34 | { |
@@ -37,15 +37,6 @@ char * bb_getgrgid(char *group, long gid, int bufsize) | |||
37 | return bb_getug(group, (mygroup) ? | 37 | return bb_getug(group, (mygroup) ? |
38 | mygroup->gr_name : (char *)mygroup, gid, bufsize, 'g'); | 38 | mygroup->gr_name : (char *)mygroup, gid, bufsize, 'g'); |
39 | } | 39 | } |
40 | #endif /* L_bb_getgrgid */ | ||
41 | |||
42 | #ifdef L_bb_xgetgrnam | ||
43 | #include <stdio.h> | ||
44 | #include <string.h> | ||
45 | #include "libbb.h" | ||
46 | #include "pwd_.h" | ||
47 | #include "grp_.h" | ||
48 | |||
49 | 40 | ||
50 | /* returns a gid given a group name */ | 41 | /* returns a gid given a group name */ |
51 | long bb_xgetgrnam(const char *name) | 42 | long bb_xgetgrnam(const char *name) |
@@ -58,15 +49,6 @@ long bb_xgetgrnam(const char *name) | |||
58 | 49 | ||
59 | return (mygroup->gr_gid); | 50 | return (mygroup->gr_gid); |
60 | } | 51 | } |
61 | #endif /* L_bb_xgetgrnam */ | ||
62 | |||
63 | #ifdef L_bb_xgetpwnam | ||
64 | #include <stdio.h> | ||
65 | #include <string.h> | ||
66 | #include "libbb.h" | ||
67 | #include "pwd_.h" | ||
68 | #include "grp_.h" | ||
69 | |||
70 | 52 | ||
71 | /* returns a uid given a username */ | 53 | /* returns a uid given a username */ |
72 | long bb_xgetpwnam(const char *name) | 54 | long bb_xgetpwnam(const char *name) |
@@ -79,9 +61,7 @@ long bb_xgetpwnam(const char *name) | |||
79 | 61 | ||
80 | return myuser->pw_uid; | 62 | return myuser->pw_uid; |
81 | } | 63 | } |
82 | #endif /* L_bb_xgetpwnam */ | ||
83 | 64 | ||
84 | #ifdef L_bb_getpwuid | ||
85 | /* Hacked by Tito Ragusa (c) 2004 <farmatito@tiscali.it> to make it more | 65 | /* Hacked by Tito Ragusa (c) 2004 <farmatito@tiscali.it> to make it more |
86 | * flexible : | 66 | * flexible : |
87 | * | 67 | * |
@@ -99,9 +79,6 @@ long bb_xgetpwnam(const char *name) | |||
99 | * the program exits. | 79 | * the program exits. |
100 | */ | 80 | */ |
101 | 81 | ||
102 | #include "libbb.h" | ||
103 | #include "pwd_.h" | ||
104 | |||
105 | /* gets a username given a uid */ | 82 | /* gets a username given a uid */ |
106 | char * bb_getpwuid(char *name, long uid, int bufsize) | 83 | char * bb_getpwuid(char *name, long uid, int bufsize) |
107 | { | 84 | { |
@@ -110,9 +87,7 @@ char * bb_getpwuid(char *name, long uid, int bufsize) | |||
110 | return bb_getug(name, (myuser) ? | 87 | return bb_getug(name, (myuser) ? |
111 | myuser->pw_name : (char *)myuser , uid, bufsize, 'u'); | 88 | myuser->pw_name : (char *)myuser , uid, bufsize, 'u'); |
112 | } | 89 | } |
113 | #endif /* L_bb_getpwuid */ | ||
114 | 90 | ||
115 | #ifdef L_bb_getug | ||
116 | /* | 91 | /* |
117 | * if bufsize is > 0 char *buffer can not be set to NULL. | 92 | * if bufsize is > 0 char *buffer can not be set to NULL. |
118 | * If idname is not NULL it is written on the static | 93 | * If idname is not NULL it is written on the static |
@@ -127,11 +102,6 @@ char * bb_getpwuid(char *name, long uid, int bufsize) | |||
127 | * else an error message is printed and the program exits. | 102 | * else an error message is printed and the program exits. |
128 | */ | 103 | */ |
129 | 104 | ||
130 | #include <stdio.h> | ||
131 | #include <assert.h> | ||
132 | #include "libbb.h" | ||
133 | |||
134 | |||
135 | /* internal function for bb_getpwuid and bb_getgrgid */ | 105 | /* internal function for bb_getpwuid and bb_getgrgid */ |
136 | char * bb_getug(char *buffer, char *idname, long id, int bufsize, char prefix) | 106 | char * bb_getug(char *buffer, char *idname, long id, int bufsize, char prefix) |
137 | { | 107 | { |
@@ -146,13 +116,6 @@ char * bb_getug(char *buffer, char *idname, long id, int bufsize, char prefix) | |||
146 | } | 116 | } |
147 | return idname; | 117 | return idname; |
148 | } | 118 | } |
149 | #endif /* L_bb_getug */ | ||
150 | |||
151 | |||
152 | #ifdef L_get_ug_id | ||
153 | /* indirect dispatcher for pwd helpers. */ | ||
154 | #include <stdlib.h> | ||
155 | #include "libbb.h" | ||
156 | 119 | ||
157 | unsigned long get_ug_id(const char *s, | 120 | unsigned long get_ug_id(const char *s, |
158 | long (*__bb_getxxnam)(const char *)) | 121 | long (*__bb_getxxnam)(const char *)) |
@@ -167,4 +130,3 @@ unsigned long get_ug_id(const char *s, | |||
167 | 130 | ||
168 | return r; | 131 | return r; |
169 | } | 132 | } |
170 | #endif /* L_get_ug_id */ | ||