* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid
[] = "@(#)getpwnamuid.c 5.3 (Berkeley) %G%";
#endif LIBC_SCCS and not lint
static char line
[BUFSIZ
+1];
static struct passwd passwd
;
* The following are shared with getpwent.c
return ((struct passwd
*)NULL
);
key
= dbm_fetch(_pw_db
, key
);
return ((struct passwd
*)NULL
);
#define EXPAND(e) passwd.e = tp; while (*tp++ = *cp++);
bcopy(cp
, (char *)&passwd
.pw_uid
, sizeof (int));
bcopy(cp
, (char *)&passwd
.pw_gid
, sizeof (int));
bcopy(cp
, (char *)&passwd
.pw_quota
, sizeof (int));
register struct passwd
*pw
;
if (_pw_db
== (DBM
*)0 &&
(_pw_db
= dbm_open(_pw_file
, O_RDONLY
)) == (DBM
*)0) {
while ((pw
= getpwent()) && strcmp(nam
, pw
->pw_name
))
if (flock(dbm_dirfno(_pw_db
), LOCK_SH
) < 0) {
(void) flock(dbm_dirfno(_pw_db
), LOCK_UN
);
register struct passwd
*pw
;
if (_pw_db
== (DBM
*)0 &&
(_pw_db
= dbm_open(_pw_file
, O_RDONLY
)) == (DBM
*)0) {
while ((pw
= getpwent()) && pw
->pw_uid
!= uid
)
if (flock(dbm_dirfno(_pw_db
), LOCK_SH
) < 0) {
key
.dptr
= (char *) &uid
;
(void) flock(dbm_dirfno(_pw_db
), LOCK_UN
);