From 7f7cd5e473c35295013e90699288a826feb52388 Mon Sep 17 00:00:00 2001 From: Oliver Lehmann Date: Sat, 14 Feb 2009 18:37:14 +0000 Subject: [PATCH] add changes to get it to compile on WEGA --- WEGA/contrib/K5JB/Makefile.unix | 15 ++++++++++----- WEGA/contrib/K5JB/iproute.c | 27 +++++++++++++++++++++++++++ WEGA/contrib/K5JB/mbuf.c | 16 ++++++++++++++++ WEGA/contrib/K5JB/mkdep | 9 ++++++++- WEGA/contrib/K5JB/options.h | 2 ++ WEGA/contrib/K5JB/session.h | 2 ++ WEGA/contrib/K5JB/sys5_io.c | 7 +++++++ WEGA/contrib/K5JB/sys5unix.c | 1 + WEGA/contrib/K5JB/telnet.c | 3 +++ WEGA/contrib/K5JB/timer.h | 4 ++++ WEGA/contrib/K5JB/ttydriv.c | 2 ++ WEGA/contrib/K5JB/unixopt.h | 8 ++++++++ 12 files changed, 90 insertions(+), 6 deletions(-) diff --git a/WEGA/contrib/K5JB/Makefile.unix b/WEGA/contrib/K5JB/Makefile.unix index 6fcee07..e898381 100644 --- a/WEGA/contrib/K5JB/Makefile.unix +++ b/WEGA/contrib/K5JB/Makefile.unix @@ -11,10 +11,11 @@ SHELL = /bin/sh TAR = tar # Use gzip instead of compress if you and your correspondents have it ZIPPER = compress +CC = lcc # If you have shared libraries (usually /lib/libc_s.a) you can make # smaller executable with SHLIB defined: -SHLIB=-lc_s +#SHLIB=-lc_s # Otherwise, enable: #SHLIB= @@ -22,7 +23,7 @@ SHLIB=-lc_s # The W5GFE video modification has been put in unixopt.h. This modifi- # cation cause inverse video on incoming telnet data. # Change unixopt.h, if necessary, and define your curses library. -CURSES=-lcurses +#CURSES=-lcurses # Or, if you don't have curses, forget the whole thing and enable: #CURSES= # @@ -74,8 +75,8 @@ CURSES=-lcurses # Uncomment the next three lines for # Unix System V -- (AT&T 3B2 - K5JB) # -CFLAGS = -O -DUNIX -DSYS5 -DSLOWCHECK -DMSPTICK=10 -LINTFLAGS = -O -DUNIX -DSYS5 -DSLOWCHECK -DMSPTICK=10 +CFLAGS = -DWEGA -DUNIX -DSYS5 -DSLOWCHECK +LINTFLAGS = -DWEGA -DUNIX -DSYS5 -DSLOWCHECK LIBS =$(SHLIB) $(CURSES) ######################################################################## # @@ -137,7 +138,11 @@ lint: $(SRCS) # lint $(LINTFLAGS) [i-z]*.ln > lint3.out 2>&1 depend: - mkdep $(LINTFLAGS) $(SRCS) > depend.out + rm -f depend.out + touch depend.out + for file in $(SRCS) ; do \ + mkdep $(LINTFLAGS) $$file > depend.out ; \ + done clean: -rm *.o diff --git a/WEGA/contrib/K5JB/iproute.c b/WEGA/contrib/K5JB/iproute.c index 609940f..c65f681 100644 --- a/WEGA/contrib/K5JB/iproute.c +++ b/WEGA/contrib/K5JB/iproute.c @@ -589,7 +589,11 @@ int16 len; sum += loword(ph->source); sum += hiword(ph->dest); sum += loword(ph->dest); +#ifdef WEGA + sum += (int)ph->protocol; +#else sum += uchar(ph->protocol); +#endif sum += ph->length; } /* Now do each mbuf on the chain */ @@ -601,9 +605,17 @@ int16 len; if(((long)up) & 1){ /* Handle odd leading byte */ if(swap) +#ifdef WEGA + csum = (int)(*up++); +#else csum = uchar(*up++); +#endif else +#ifdef WEGA + csum = (int16)((int)(*up++) << 8); +#else csum = (int16)(uchar(*up++) << 8); +#endif cnt--; swap = !swap; } @@ -620,9 +632,24 @@ int16 len; /* Handle odd trailing byte */ if(cnt & 1){ if(swap) +#ifdef WEGA + { + unsigned short tmp; + + tmp = (unsigned short)up[--cnt]; + tmp <<= 8; + tmp >>= 8; + csum += tmp; + } +#else csum += uchar(up[--cnt]); +#endif else +#ifdef WEGA + csum += (int16)((int)(up[--cnt]) << 8); +#else csum += (int16)(uchar(up[--cnt]) << 8); +#endif swap = !swap; } sum += csum; diff --git a/WEGA/contrib/K5JB/mbuf.c b/WEGA/contrib/K5JB/mbuf.c index 94b2e5a..50d86f9 100644 --- a/WEGA/contrib/K5JB/mbuf.c +++ b/WEGA/contrib/K5JB/mbuf.c @@ -479,6 +479,9 @@ pull32(bpp) struct mbuf **bpp; { int32 rval; +#ifdef WEGA + int16 rval1, rval2; +#endif char buf[4]; register char *cp; @@ -489,6 +492,18 @@ struct mbuf **bpp; cp = buf; /* Unwound for speed */ +#ifdef WEGA + rval1 = uchar(*cp++); + rval1 <<= 8; + rval1 |= uchar(*cp++); + rval2 = uchar(*cp++); + rval2 <<= 8; + rval2 |= uchar(*cp); + + rval = rval1; + rval <<= 16; + rval |= rval2; +#else rval = uchar(*cp++); rval <<= 8; rval |= uchar(*cp++); @@ -496,6 +511,7 @@ struct mbuf **bpp; rval |= uchar(*cp++); rval <<= 8; rval |= uchar(*cp); +#endif return rval; } diff --git a/WEGA/contrib/K5JB/mkdep b/WEGA/contrib/K5JB/mkdep index ea0a297..4e3c22c 100755 --- a/WEGA/contrib/K5JB/mkdep +++ b/WEGA/contrib/K5JB/mkdep @@ -4,6 +4,13 @@ # cpparg= linelen=60 # desired length of dependency line +system=`uname -s` +if [ "$system" = "P8000" ] ; then + cpp_cmd=/z/LCC/lib/lcpp +else + cpp_cmd=/lib/cpp +fi + for arg in "$@" do case $arg in @@ -15,7 +22,7 @@ do target=`expr "$source" : '\\(.*\\)\\.c$'` if [ -n "$target" ]; then target=`basename "$target"` - /lib/cpp $cpparg "$source" | + $cpp_cmd $cpparg "$source" | sed -n -e 's/^# 1 "\(.*\)"/\1/p' | awk ' BEGIN { deplist = "'$target.o:'" } diff --git a/WEGA/contrib/K5JB/options.h b/WEGA/contrib/K5JB/options.h index 774cbd6..dc8417e 100644 --- a/WEGA/contrib/K5JB/options.h +++ b/WEGA/contrib/K5JB/options.h @@ -56,7 +56,9 @@ #define MDKISSPORT /* Multidrop KISS, up to 16 pseudo ports, 1016 bytes */ #define MULPORT /* Grapes Multiport code - adds 1398 bytes */ #define AX25_HEARD /* Heard list - adds 3716 bytes */ +#ifndef WEGA #define CUTE_VIDEO /* Contrast video on incoming sessions. Adds 484 Bytes */ +#endif #undef TRACE_TIME /* Trace timestamping */ #define SEG_CMD /* ax25 segment command */ #define REWRITE /* rewrite.net file for smtp server */ diff --git a/WEGA/contrib/K5JB/session.h b/WEGA/contrib/K5JB/session.h index b0763eb..36afda5 100644 --- a/WEGA/contrib/K5JB/session.h +++ b/WEGA/contrib/K5JB/session.h @@ -37,7 +37,9 @@ struct session { char *rfile; /* Record file name */ FILE *upload; /* Send file */ char *ufile; /* Upload file name */ +#ifndef WEGA /* leads to problems because of conflicting function noecho() */ char noecho; /* Echo flag */ +#endif }; #define NULLSESSION (struct session *)0 extern unsigned nsessions; diff --git a/WEGA/contrib/K5JB/sys5_io.c b/WEGA/contrib/K5JB/sys5_io.c index 81aca7d..fa02523 100644 --- a/WEGA/contrib/K5JB/sys5_io.c +++ b/WEGA/contrib/K5JB/sys5_io.c @@ -39,6 +39,9 @@ #ifndef COH386 #include #endif +#ifdef WEGA +#include /* for errno declaration */ +#endif #include #include #include @@ -56,8 +59,12 @@ #endif #ifndef B38400 +#ifdef WEGA +#define B38400 EXTA +#else #define B38400 EXTB #endif +#endif struct asy asy[ASY_MAX]; struct interface *ifaces; diff --git a/WEGA/contrib/K5JB/sys5unix.c b/WEGA/contrib/K5JB/sys5unix.c index 959348a..3bbe5c9 100644 --- a/WEGA/contrib/K5JB/sys5unix.c +++ b/WEGA/contrib/K5JB/sys5unix.c @@ -48,6 +48,7 @@ #include "unix.h" #include "unixopt.h" #include "ndir.h" +#include "timer.h" #define MAXCMD 1024 diff --git a/WEGA/contrib/K5JB/telnet.c b/WEGA/contrib/K5JB/telnet.c index b832de6..118a2f8 100644 --- a/WEGA/contrib/K5JB/telnet.c +++ b/WEGA/contrib/K5JB/telnet.c @@ -2,6 +2,9 @@ #include "config.h" #ifdef _TELNET #include +#ifdef WEGA +#include /* to get the return value of memchr() right */ +#endif #include "global.h" #include "mbuf.h" #include "timer.h" diff --git a/WEGA/contrib/K5JB/timer.h b/WEGA/contrib/K5JB/timer.h index afaa47a..133a0cc 100644 --- a/WEGA/contrib/K5JB/timer.h +++ b/WEGA/contrib/K5JB/timer.h @@ -26,10 +26,14 @@ struct timer { #if ATARI_ST && (!MWC) #define MSPTICK 100 /* Milliseconds per tick */ #else +#ifdef WEGA +#define MSPTICK 17 +#else /* for only a 10% error you can make all time reports pretty by using * 50 instead of 55 here */ #define MSPTICK 55 /* (approx) Milliseconds per tick */ +#endif /* WEGA */ #endif /* ATARI, etc */ #endif diff --git a/WEGA/contrib/K5JB/ttydriv.c b/WEGA/contrib/K5JB/ttydriv.c index 87b6183..a8047dd 100644 --- a/WEGA/contrib/K5JB/ttydriv.c +++ b/WEGA/contrib/K5JB/ttydriv.c @@ -22,7 +22,9 @@ #ifdef NETROM #include "nr4.h" #endif +#ifndef WEGA #include "iface.h" +#endif #include "tcp.h" #include "session.h" #include "cmdparse.h" diff --git a/WEGA/contrib/K5JB/unixopt.h b/WEGA/contrib/K5JB/unixopt.h index f11f4f0..8814508 100644 --- a/WEGA/contrib/K5JB/unixopt.h +++ b/WEGA/contrib/K5JB/unixopt.h @@ -3,7 +3,9 @@ */ /* if you have the mkdir() function, define the following: */ +#ifndef WEGA #define HAVEMKDIR +#endif /* This is a wait value for the Coherent sleep2() function */ #define COHWAIT 50 /* 50 ms */ @@ -20,19 +22,25 @@ * Contact me for source code if you have same problem. */ +#ifndef WEGA #define TELUNIX +#endif /* On k5jb3b2 only, has to do with brain damaged pty on my machine. * Don't define this unless you have the file that I call telunix.c3 * linked to telunix.c in your set. */ +#ifndef WEGA #define PTY_PIPE +#endif /* a client stub with PORT 87. Uses IPC to transact with a server. * Contact me for a sample server if you want to try this. */ +#ifndef WEGA #define TELSERV #define SERVNAME "telserv" /* suggest 7 max for screen formatting */ +#endif #ifdef _OSK #undef TELUNIX