From 5adb5c82e3250f87ca56994c837460250b05aff0 Mon Sep 17 00:00:00 2001 From: Mark Murray Date: Mon, 20 Aug 2001 12:04:53 +0000 Subject: [PATCH] No functional changes, but: o unifdef AUTHENTICATE. We have never compiled this code, and its doubtful it will even work in this case. o Style changes (some ansification, some comment updating) o Diff reduction and code style merging with crypto telnet. --- lib/libtelnet/Makefile | 12 +++++----- lib/libtelnet/genget.c | 48 +++++++++++++++++++------------------- lib/libtelnet/getent.c | 13 +++++++---- lib/libtelnet/misc-proto.h | 2 ++ lib/libtelnet/misc.c | 10 ++++---- 5 files changed, 47 insertions(+), 38 deletions(-) diff --git a/lib/libtelnet/Makefile b/lib/libtelnet/Makefile index 8ee712971c55..ec466707a5b4 100644 --- a/lib/libtelnet/Makefile +++ b/lib/libtelnet/Makefile @@ -1,18 +1,18 @@ # From: @(#)Makefile 8.2 (Berkeley) 12/15/93 # $FreeBSD$ -LIB= telnet +LIB= telnet -INTERNALLIB=yes +INTERNALLIB= yes INTERNALSTATICLIB=yes -NOPIC= yes +NOPIC= yes -SRCS= genget.c getent.c misc.c -CFLAGS+= -DHAS_CGETENT +SRCS= genget.c getent.c misc.c +CFLAGS+= -DHAS_CGETENT # # Remove obsolete shared libraries, if any. We don't bother moving them -# to/usr/lib/compat, since they were only used by telnet, telnetd and +# to /usr/lib/compat, since they were only used by telnet, telnetd and # tn3270. # beforeinstall: diff --git a/lib/libtelnet/genget.c b/lib/libtelnet/genget.c index 29c7519887f7..62f272a640de 100644 --- a/lib/libtelnet/genget.c +++ b/lib/libtelnet/genget.c @@ -32,7 +32,12 @@ */ #ifndef lint -static char sccsid[] = "@(#)genget.c 8.1 (Berkeley) 6/4/93"; +#if 0 +static const char sccsid[] = "@(#)genget.c 8.2 (Berkeley) 5/30/95"; +#else +static const char rcsid[] = + "$FreeBSD$"; +#endif #endif /* not lint */ @@ -45,37 +50,33 @@ static char sccsid[] = "@(#)genget.c 8.1 (Berkeley) 6/4/93"; * the length is returned. If *s1 is a prefix of *s2, * the length of *s1 is returned. */ - int -isprefix(s1, s2) - register char *s1, *s2; +int +isprefix(char *s1, char *s2) { - char *os1; - register char c1, c2; + char *os1; + char c1, c2; - if (*s1 == '\0') - return(-1); - os1 = s1; + if (*s1 == '\0') + return(-1); + os1 = s1; c1 = *s1; c2 = *s2; - while (LOWER(c1) == LOWER(c2)) { + while (LOWER(c1) == LOWER(c2)) { if (c1 == '\0') break; - c1 = *++s1; - c2 = *++s2; - } - return(*s1 ? 0 : (*s2 ? (s1 - os1) : (os1 - s1))); + c1 = *++s1; + c2 = *++s2; + } + return(*s1 ? 0 : (*s2 ? (s1 - os1) : (os1 - s1))); } static char *ambiguous; /* special return value for command routines */ - char ** -genget(name, table, stlen) - char *name; /* name to match */ - char **table; /* name entry in table */ - int stlen; +char ** +genget(char *name, char **table, int stlen) { - register char **c, **found; - register int n; + char **c, **found; + int n; if (name == 0) return 0; @@ -96,9 +97,8 @@ genget(name, table, stlen) /* * Function call version of Ambiguous() */ - int -Ambiguous(s) - char *s; +int +Ambiguous(char *s) { return((char **)s == &ambiguous); } diff --git a/lib/libtelnet/getent.c b/lib/libtelnet/getent.c index 0956a2abd381..03bef5f24255 100644 --- a/lib/libtelnet/getent.c +++ b/lib/libtelnet/getent.c @@ -32,17 +32,23 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)getent.c 8.2 (Berkeley) 12/15/93"; +#else +static const char rcsid[] = + "$FreeBSD$"; +#endif #endif /* not lint */ +#ifdef HAS_CGETENT #include +#endif static char *area; /*ARGSUSED*/ int -getent(cp, name) -char *cp, *name; +getent(char *cp, char *name) { #ifdef HAS_CGETENT char *dba[2]; @@ -58,8 +64,7 @@ char *cp, *name; #ifndef SOLARIS /*ARGSUSED*/ char * -Getstr(id, cpp) -char *id, **cpp; +Getstr(char *id, char **cpp) { # ifdef HAS_CGETENT char *answer; diff --git a/lib/libtelnet/misc-proto.h b/lib/libtelnet/misc-proto.h index e5f334a9bdd0..c0d20685d462 100644 --- a/lib/libtelnet/misc-proto.h +++ b/lib/libtelnet/misc-proto.h @@ -31,6 +31,7 @@ * SUCH DAMAGE. * * @(#)misc-proto.h 8.1 (Berkeley) 6/4/93 + * $FreeBSD$ */ /* @@ -76,4 +77,5 @@ void net_encrypt P((void)); int telnet_spin P((void)); char *telnet_getenv P((char *)); char *telnet_gets P((char *, char *, int, int)); +void printsub P((int, unsigned char *, int)); #endif diff --git a/lib/libtelnet/misc.c b/lib/libtelnet/misc.c index d4242b689be6..8e7c7dd018f5 100644 --- a/lib/libtelnet/misc.c +++ b/lib/libtelnet/misc.c @@ -32,7 +32,12 @@ */ #ifndef lint -static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/4/93"; +#if 0 +static const char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/4/93"; +#else +static const char rcsid[] = + "$FreeBSD$"; +#endif #endif /* not lint */ #include @@ -53,9 +58,6 @@ auth_encrypt_init(local, remote, name, server) { RemoteHostName = remote; LocalHostName = local; -#if defined(AUTHENTICATION) - auth_init(name, server); -#endif if (UserNameRequested) { free(UserNameRequested); UserNameRequested = 0;