diff options
author | markm <markm@FreeBSD.org> | 2001-11-30 21:55:10 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2001-11-30 21:55:10 +0000 |
commit | 33f349996fd8350d4e5943fea640bf1b77088e70 (patch) | |
tree | 651c3cac194a459245d30fafaa3baf897285aa10 /lib/libtelnet/getent.c | |
parent | aa8360c1cd7a7e842c08ab62bfc84fa95a2826c3 (diff) | |
download | FreeBSD-src-33f349996fd8350d4e5943fea640bf1b77088e70.zip FreeBSD-src-33f349996fd8350d4e5943fea640bf1b77088e70.tar.gz |
Invoke the new 'unifdef:' target, and make this lib a complete subset
of the crypto (master) code.
Diffstat (limited to 'lib/libtelnet/getent.c')
-rw-r--r-- | lib/libtelnet/getent.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/libtelnet/getent.c b/lib/libtelnet/getent.c index ee6f03f..d6e8d9c 100644 --- a/lib/libtelnet/getent.c +++ b/lib/libtelnet/getent.c @@ -32,6 +32,7 @@ */ #include <sys/cdefs.h> + __FBSDID("$FreeBSD$"); #ifndef lint @@ -40,37 +41,36 @@ static char sccsid[] = "@(#)getent.c 8.2 (Berkeley) 12/15/93"; #endif #endif /* not lint */ -#ifdef HAS_CGETENT #include <stdlib.h> -#endif +#include <string.h> + +#include "misc-proto.h" static char *area; +static char gettytab[] = "/etc/gettytab"; /*ARGSUSED*/ int -getent(char *cp, char *name) +getent(char *cp __unused, const char *name) { -#ifdef HAS_CGETENT - char *dba[2]; + int retval; + char *tempnam, *dba[2] = { gettytab, NULL }; - dba[0] = "/etc/gettytab"; - dba[1] = 0; - return((cgetent(&area, dba, name) == 0) ? 1 : 0); -#else - return(0); -#endif + tempnam = strdup(name); + retval = cgetent(&area, dba, tempnam) == 0 ? 1 : 0; + free(tempnam); + return(retval); } -#ifndef SOLARIS /*ARGSUSED*/ char * -Getstr(char *id, char **cpp) +Getstr(const char *id, char **cpp __unused) { -# ifdef HAS_CGETENT - char *answer; - return((cgetstr(area, id, &answer) > 0) ? answer : 0); -# else - return(0); -# endif + int retval; + char *answer, *tempid; + + tempid = strdup(id); + retval = cgetstr(area, tempid, &answer); + free(tempid); + return((retval > 0) ? answer : NULL); } -#endif |