Lines Matching defs:mypwd

5 /*	mypwd 3
9 /* #include <mypwd.h>
65 #include "mypwd.h"
79 struct mypasswd *mypwd;
88 mypwd = (struct mypasswd *) mymalloc(sizeof(*mypwd));
89 mypwd->refcount = 0;
90 mypwd->pw_name = mystrdup(pwd->pw_name);
91 mypwd->pw_passwd = mystrdup(pwd->pw_passwd);
92 mypwd->pw_uid = pwd->pw_uid;
93 mypwd->pw_gid = pwd->pw_gid;
94 mypwd->pw_gecos = mystrdup(pwd->pw_gecos);
95 mypwd->pw_dir = mystrdup(pwd->pw_dir);
96 mypwd->pw_shell = mystrdup(*pwd->pw_shell ? pwd->pw_shell : _PATH_BSHELL);
97 htable_enter(mypwcache_name, mypwd->pw_name, (char *) mypwd);
98 binhash_enter(mypwcache_uid, (char *) &mypwd->pw_uid,
99 sizeof(mypwd->pw_uid), (char *) mypwd);
100 return (mypwd);
108 struct mypasswd *mypwd;
118 mypwd = last_pwd;
119 mypwd->refcount++;
120 return (mypwd);
128 if ((mypwd = (struct mypasswd *)
132 mypwd = mypwenter(pwd);
134 last_pwd = mypwd;
135 mypwd->refcount += 2;
136 return (mypwd);
144 struct mypasswd *mypwd;
154 mypwd = last_pwd;
155 mypwd->refcount++;
156 return (mypwd);
164 if ((mypwd = (struct mypasswd *) htable_find(mypwcache_name, name)) == 0) {
167 mypwd = mypwenter(pwd);
169 last_pwd = mypwd;
170 mypwd->refcount += 2;
171 return (mypwd);
176 void mypwfree(struct mypasswd * mypwd)
178 if (mypwd->refcount < 1)
179 msg_panic("mypwfree: refcount %d", mypwd->refcount);
181 if (--mypwd->refcount == 0) {
182 htable_delete(mypwcache_name, mypwd->pw_name, (void (*) (char *)) 0);
183 binhash_delete(mypwcache_uid, (char *) &mypwd->pw_uid,
184 sizeof(mypwd->pw_uid), (void (*) (char *)) 0);
185 myfree(mypwd->pw_name);
186 myfree(mypwd->pw_passwd);
187 myfree(mypwd->pw_gecos);
188 myfree(mypwd->pw_dir);
189 myfree(mypwd->pw_shell);
190 myfree((char *) mypwd);
207 struct mypasswd **mypwd;
214 mypwd = (struct mypasswd **) mymalloc((argc + 1) * sizeof(*mypwd));
218 mypwd[i] = mypwuid(atoi(argv[i]));
220 mypwd[i] = mypwnam(argv[i]);
221 if (mypwd[i] == 0)
223 msg_info("+ %s link=%d used=%d used=%d", argv[i], mypwd[i]->refcount,
227 msg_info("- %s link=%d used=%d used=%d", argv[i], mypwd[i]->refcount,
229 mypwfree(mypwd[i]);
232 myfree((char *) mypwd);