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) OBJS = $(LIBTELNET_OBJS) $(TELNET_OBJS) $(TELNETD_OBJS)
INCLUDES = -I libtelnet -I . 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 TELNETD_DEFINES = -DDIAGNOSTICS -DOLD_ENVIRON -DENV_HACK -DSTREAMSPTY
DEFINES = $(TELNET_DEFINES) $(TELNETD_DEFINES) DEFINES = $(TELNET_DEFINES) $(TELNETD_DEFINES)
LIBS = -ltermcap 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/param.h>
#include <sys/un.h> #ifndef __GNO__
# include <sys/un.h>
#endif
#include <sys/file.h> #include <sys/file.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.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/in_systm.h>
#include <netinet/ip.h> #include <netinet/ip.h>
#include <netinet/ip6.h> #ifdef INET6
# include <netinet/ip6.h>
#endif
#ifndef MAXHOSTNAMELEN #ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256 #define MAXHOSTNAMELEN 256
@ -1345,7 +1349,7 @@ suspend(void)
} }
static int static int
shell(int argc, char *argv[] __unused) shell(int argc, char **argv __unused)
{ {
long oldrows, oldcols, newrows, newcols, err_; long oldrows, oldcols, newrows, newcols, err_;
@ -2100,9 +2104,11 @@ sockaddr_ntop(struct sockaddr *sa)
case AF_INET: case AF_INET:
addr = &((struct sockaddr_in *)sa)->sin_addr; addr = &((struct sockaddr_in *)sa)->sin_addr;
break; break;
#ifndef __GNO__
case AF_UNIX: case AF_UNIX:
addr = &((struct sockaddr_un *)sa)->sun_path; addr = &((struct sockaddr_un *)sa)->sun_path;
break; break;
#endif
#ifdef INET6 #ifdef INET6
case AF_INET6: case AF_INET6:
addr = &((struct sockaddr_in6 *)sa)->sin6_addr; addr = &((struct sockaddr_in6 *)sa)->sin6_addr;
@ -2169,7 +2175,7 @@ switch_af(struct addrinfo **aip)
#endif #endif
int int
tn(int argc, char *argv[]) tn(int argc, char **argv)
{ {
char *srp = 0; char *srp = 0;
int proto, opt; int proto, opt;
@ -2256,6 +2262,7 @@ tn(int argc, char *argv[])
src_res0 = src_res; src_res0 = src_res;
} }
if (hostp[0] == '/') { if (hostp[0] == '/') {
#ifndef __GNO__
struct sockaddr_un su; struct sockaddr_un su;
if (strlen(hostp) >= sizeof(su.sun_path)) { if (strlen(hostp) >= sizeof(su.sun_path)) {
@ -2279,6 +2286,10 @@ tn(int argc, char *argv[])
goto fail; goto fail;
} }
goto af_unix; goto af_unix;
#else
fprintf(stderr, "UNIX domain sockets are not supported on GNO\n");
goto fail;
#endif
} else if (hostp[0] == '@' || hostp[0] == '!') { } else if (hostp[0] == '@' || hostp[0] == '!') {
if ( if (
#ifdef INET6 #ifdef INET6

View File

@ -346,7 +346,7 @@ main(int argc, char *argv[])
autologin = (rlogin == _POSIX_VDISABLE) ? 0 : 1; autologin = (rlogin == _POSIX_VDISABLE) ? 0 : 1;
argc -= optind; argc -= optind;
argv += optind; argv = argv + optind;
if (argc) { if (argc) {
char *args[9], **argp = args; 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 <ctype.h>
#include <curses.h>
#include <signal.h> #include <signal.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@ -62,6 +61,7 @@ static const char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95";
#include "general.h" #include "general.h"
#ifdef USE_TERMIO #ifdef USE_TERMIO
# include <curses.h>
# include <term.h> # include <term.h>
#else #else
# include <termcap.h> # include <termcap.h>

View File

@ -46,3 +46,7 @@ struct termspeeds {
}; };
extern struct termspeeds 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); fprintf(NetTrace, "%s IAC %d", direction, option);
} else { } else {
const char *fmt; const char *fmt;
fmt = (cmd == WILL) ? "WILL" : (cmd == WONT) ? "WONT" : switch (cmd) {
(cmd == DO) ? "DO" : (cmd == DONT) ? "DONT" : 0; 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) { if (fmt) {
fprintf(NetTrace, "%s %s ", direction, fmt); fprintf(NetTrace, "%s %s ", direction, fmt);
if (TELOPT_OK(option)) if (TELOPT_OK(option))

View File

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

View File

@ -174,7 +174,7 @@ extern void
willoption(int), willoption(int),
wontoption(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 output_datalen(const char *, int);
void startslave(char *, int, char *); 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/types.h>
#include <sys/tty.h> #ifdef USE_TERMIO
# include <sys/tty.h>
#endif
#include <stdlib.h> #include <stdlib.h>
#include "telnetd.h" #include "telnetd.h"

View File

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