From 1d35c611461f22e6f55cc3d1260d24417cae4cad Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Mon, 1 Jun 2015 20:37:04 -0500 Subject: [PATCH] Misc. small changes to remove uses of unavailable functions in telnetd. Also include libutil for login_tty function. --- Makefile.common | 2 +- Makefile.mk | 2 +- telnetd/sys_term.c | 2 ++ telnetd/telnetd.c | 2 +- telnetd/utility.c | 6 ++++++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile.common b/Makefile.common index ce3fc01..3a1d0ea 100644 --- a/Makefile.common +++ b/Makefile.common @@ -56,7 +56,7 @@ OBJS = $(LIBTELNET_OBJS) $(TELNET_OBJS) $(TELNETD_OBJS) INCLUDES = -I libtelnet -I . TELNET_DEFINES = -DTERMCAP -DKLUDGELINEMODE -DENV_HACK -TELNETD_DEFINES = -DDIAGNOSTICS -DOLD_ENVIRON -DENV_HACK -DSTREAMSPTY +TELNETD_DEFINES = -DDIAGNOSTICS -DOLD_ENVIRON -DENV_HACK TELNET_SPECIFIC = $(TELNET_DEFINES) -I telnet TELNETD_SPECIFIC = $(TELNETD_DEFINES) -I telnetd diff --git a/Makefile.mk b/Makefile.mk index 3da4bcf..4160904 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -4,7 +4,7 @@ # from 2.0.6 is broken (links to unimplemented functions), so don't use it. # The 2.0.4 version is in the "lib.shk" file within # ftp://ftp.gno.org/pub/apple2/gs.specific/gno/base/v204/gnodisk1.sdk -LIBS = -l/usr/lib/libtermcap.204 -l/usr/lib/libnetdb +LIBS = -l/usr/lib/libtermcap.204 -l/usr/lib/libnetdb -l/usr/lib/libutil CFLAGS = -i -w diff --git a/telnetd/sys_term.c b/telnetd/sys_term.c index fd64fc4..6eb69fd 100644 --- a/telnetd/sys_term.c +++ b/telnetd/sys_term.c @@ -907,10 +907,12 @@ cleanopen(char *li) * Make sure that other people can't open the * slave side of the connection. */ +#ifndef __GNO__ (void) chown(li, 0, 0); (void) chmod(li, 0600); (void) revoke(li); +#endif t = open(line, O_RDWR|O_NOCTTY); diff --git a/telnetd/telnetd.c b/telnetd/telnetd.c index 0342d4e..495a8d8 100644 --- a/telnetd/telnetd.c +++ b/telnetd/telnetd.c @@ -718,7 +718,7 @@ doit(struct sockaddr *who_) host = inet_ntoa(who->sin_addr); break; } - if (!bcmp(hp->h_addr_list[0], (caddr_t)&who->sin_addr, + if (!memcmp(hp->h_addr_list[0], (caddr_t)&who->sin_addr, sizeof(who->sin_addr))) { host = hp->h_name; break; /* OK! */ diff --git a/telnetd/utility.c b/telnetd/utility.c index 5b6f7eb..a87e941 100644 --- a/telnetd/utility.c +++ b/telnetd/utility.c @@ -420,7 +420,9 @@ putf(char *cp, char *where) { char *slash; time_t t; +#ifndef __GNO__ char db[100]; +#endif #ifdef __FreeBSD__ static struct utsname kerninfo; @@ -463,8 +465,12 @@ putf(char *cp, char *where) setlocale(LC_TIME, ""); #endif (void)time(&t); +#ifndef __GNO__ (void)strftime(db, sizeof(db), fmtstr, localtime(&t)); putstr(db); +#else + putstr(ctime(&t)); +#endif break; #ifdef __FreeBSD__