Misc. small changes for GNO and ORCA/C compatibility

This commit is contained in:
Stephen Heumann 2015-05-31 10:13:17 -05:00
parent cfa9287257
commit 581990e767
10 changed files with 41 additions and 13 deletions

View File

@ -62,7 +62,7 @@ TELNETD_OBJS = $(TELNETD_SRCS:.c=.o)
OBJS = $(LIBTELNET_OBJS) $(TELNET_OBJS) $(TELNETD_OBJS)
INCLUDES = -I libtelnet -I .
TELNET_DEFINES = -DTERMCAP -DKLUDGELINEMODE -DENV_HACK -DOPIE
TELNET_DEFINES = -DTERMCAP -DKLUDGELINEMODE -DENV_HACK
TELNETD_DEFINES = -DDIAGNOSTICS -DOLD_ENVIRON -DENV_HACK -DSTREAMSPTY
DEFINES = $(TELNET_DEFINES) $(TELNETD_DEFINES)
LIBS = -ltermcap

View File

@ -40,7 +40,9 @@ static const char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
#include <sys/param.h>
#include <sys/un.h>
#ifndef __GNO__
# include <sys/un.h>
#endif
#include <sys/file.h>
#include <sys/socket.h>
#include <netinet/in.h>
@ -77,7 +79,9 @@ static const char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#ifdef INET6
# include <netinet/ip6.h>
#endif
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
@ -1345,7 +1349,7 @@ suspend(void)
}
static int
shell(int argc, char *argv[] __unused)
shell(int argc, char **argv __unused)
{
long oldrows, oldcols, newrows, newcols, err_;
@ -2100,9 +2104,11 @@ sockaddr_ntop(struct sockaddr *sa)
case AF_INET:
addr = &((struct sockaddr_in *)sa)->sin_addr;
break;
#ifndef __GNO__
case AF_UNIX:
addr = &((struct sockaddr_un *)sa)->sun_path;
break;
#endif
#ifdef INET6
case AF_INET6:
addr = &((struct sockaddr_in6 *)sa)->sin6_addr;
@ -2169,7 +2175,7 @@ switch_af(struct addrinfo **aip)
#endif
int
tn(int argc, char *argv[])
tn(int argc, char **argv)
{
char *srp = 0;
int proto, opt;
@ -2256,6 +2262,7 @@ tn(int argc, char *argv[])
src_res0 = src_res;
}
if (hostp[0] == '/') {
#ifndef __GNO__
struct sockaddr_un su;
if (strlen(hostp) >= sizeof(su.sun_path)) {
@ -2279,6 +2286,10 @@ tn(int argc, char *argv[])
goto fail;
}
goto af_unix;
#else
fprintf(stderr, "UNIX domain sockets are not supported on GNO\n");
goto fail;
#endif
} else if (hostp[0] == '@' || hostp[0] == '!') {
if (
#ifdef INET6

View File

@ -346,7 +346,7 @@ main(int argc, char *argv[])
autologin = (rlogin == _POSIX_VDISABLE) ? 0 : 1;
argc -= optind;
argv += optind;
argv = argv + optind;
if (argc) {
char *args[9], **argp = args;

View File

@ -47,7 +47,6 @@ static const char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95";
*/
#include <ctype.h>
#include <curses.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
@ -62,6 +61,7 @@ static const char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95";
#include "general.h"
#ifdef USE_TERMIO
# include <curses.h>
# include <term.h>
#else
# include <termcap.h>

View File

@ -46,3 +46,7 @@ struct termspeeds {
};
extern struct termspeeds termspeeds[];
#ifdef __GNO__
typedef unsigned long uint32_t;
#endif

View File

@ -185,8 +185,13 @@ printoption(const char *direction, int cmd, int option)
fprintf(NetTrace, "%s IAC %d", direction, option);
} else {
const char *fmt;
fmt = (cmd == WILL) ? "WILL" : (cmd == WONT) ? "WONT" :
(cmd == DO) ? "DO" : (cmd == DONT) ? "DONT" : 0;
switch (cmd) {
case WILL: fmt = "WILL"; break;
case WONT: fmt = "WONT"; break;
case DO: fmt = "DO"; break;
case DONT: fmt = "DONT"; break;
default: fmt = 0; break;
}
if (fmt) {
fprintf(NetTrace, "%s %s ", direction, fmt);
if (TELOPT_OK(option))

View File

@ -55,12 +55,18 @@
#endif
#include <sys/socket.h>
#ifndef SHUT_RDWR
# define SHUT_RDWR 2
#endif
#include <sys/wait.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/time.h>
#ifndef FILIO_H
# if !defined(USE_TERMIO)
# define USE_OLD_TTY
# endif
#include <sys/ioctl.h>
#else
#include <sys/filio.h>

View File

@ -174,7 +174,7 @@ extern void
willoption(int),
wontoption(int);
int output_data(const char *, ...) __printflike(1, 2);
int output_data(const char *, ...) /*__printflike(1, 2)*/;
void output_datalen(const char *, int);
void startslave(char *, int, char *);

View File

@ -40,7 +40,9 @@ static const char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
#include <sys/types.h>
#include <sys/tty.h>
#ifdef USE_TERMIO
# include <sys/tty.h>
#endif
#include <stdlib.h>
#include "telnetd.h"

View File

@ -322,7 +322,7 @@ main(int argc, char *argv[])
}
argc -= optind;
argv += optind;
argv = argv + optind;
if (debug) {
int s, ns, foo, error;
@ -1174,7 +1174,7 @@ telnet(int f, int p, char *host)
} /* end of telnet */
#ifndef TCSIG
# ifdef TIOCSIG
# if defined(TIOCSIG) && !defined(__GNO__)
# define TCSIG TIOCSIG
# endif
#endif