diff -urN x25-utils-2.1.20/Changes x25_utils-2.3.91/Changes
--- x25-utils-2.1.20/Changes	Thu Jan  1 01:00:00 1970
+++ x25_utils-2.3.91/Changes	Fri Oct 20 18:31:31 2000
@@ -0,0 +1,20 @@
+1998-09-01 Henner Eisen
+	- Added dumping of CallRequest/CallAccepted packets with
+	  extended (TOA/NPI) address format.
+	- -d option to suppress dumping of user data from Data
+	  packets.
+1998-10-15 Henner Eisen
+	- hexdump for call request packets
+	- changed socket type to AF_PACKET
+2000-10-20 Henner Eisen
+	- changed some compile and link options in the makefiles
+	  to allow compilation with glibc2
+	- changed installation target diretories to 
+	  /usr/local/{bin,sbin,man/man?}
+	- some (partially ugly hacks) in telnetd and telnet sources
+	  to make it compiling with glibc, libtermcap->libncurses,
+          <sys/ioctl.h>, ....
+	  telnetd and telnet compile now, but still do not seem to 
+	  work. Somebody with more knowledge about terminal programming
+          should have a look at it.
+
diff -urN x25-utils-2.1.20/Makefile x25_utils-2.3.91/Makefile
--- x25-utils-2.1.20/Makefile	Sun Dec 15 23:30:23 1996
+++ x25_utils-2.3.91/Makefile	Fri Oct 20 16:14:28 2000
@@ -32,12 +32,13 @@
 ################### END OF CONFIGURATION PART ###############################
 
 # Just to have a short-cut in the subdirectory Makefiles.
-IBSD=-I/usr/include/bsd -include /usr/include/bsd/bsd.h
-
+# IBSD=-I/usr/include/bsd -include /usr/include/bsd/bsd.h
+IBSD =
 # These are just a common cases. Then we don't have do write anything in the
 # sublevel makefiles.
 CFLAGS = ${O} ${IBSD}
-LDLIBS = -lbsd
+#LDLIBS = -lbsd
+LDLIBS =
 
 SUB = libtelnet telnet telnetd trace route
 
diff -urN x25-utils-2.1.20/README x25_utils-2.3.91/README
--- x25-utils-2.1.20/README	Sun Jan 12 14:25:19 1997
+++ x25_utils-2.3.91/README	Fri Oct 20 18:28:42 2000
@@ -1,5 +1,19 @@
-X.25 Utilities 2.1.20
+X.25 Utilities 2.3.91
 ---------------------
+
+This is basically identical to the previous 2.1.20 release. It mainly
+includes changes to compile and link with glibc2. x25trace also has some
+added functionality. See the Changes file for details.
+
+I could get the telnet[d] programs to compile and link by means of ugly hacks.
+However, they don't seem to work yet. If you are successful, please let me
+know.
+
+Henner  (eis@baty.hanse.de)
+
+
+Old README file contents follow:
+
 
 These are some knocked up utilities to support the X.25 code within the
 Linux kernel. The programs x25route and x25trace are new and do what they
diff -urN x25-utils-2.1.20/route/Makefile x25_utils-2.3.91/route/Makefile
--- x25-utils-2.1.20/route/Makefile	Sun Jan 12 13:46:00 1997
+++ x25_utils-2.3.91/route/Makefile	Fri Oct 20 18:31:51 2000
@@ -1,8 +1,8 @@
 x25route: x25route.o
 
 install: x25route
-	install -s x25route /usr/sbin
-	install x25route.8 /usr/man/man8
+	install -s x25route /usr/local/sbin
+	install x25route.8 /usr/local/man/man8
 
 clean:
 	rm -f *.o x25route
diff -urN x25-utils-2.1.20/telnet/Makefile x25_utils-2.3.91/telnet/Makefile
--- x25-utils-2.1.20/telnet/Makefile	Mon Dec 16 13:06:19 1996
+++ x25_utils-2.3.91/telnet/Makefile	Fri Oct 20 17:10:52 2000
@@ -1,12 +1,14 @@
 CFLAGS += '-DISSUE_FILE="/etc/issue.net"' -I.. \
-	-DTERMCAP -DUSE_TERMIO -DKLUDGELINEMODE -DDIAGNOSTICS
-LDLIBS = -lbsd -ltermcap -ltelnet -L ../libtelnet
+        -DTERMCAP -DUSE_TERMIO -DKLUDGELINEMODE -DDIAGNOSTICS
+#        -DTERMCAP -DUSE_TERMIO -DKLUDGELINEMODE -DDIAGNOSTICS
+#LDLIBS = -lbsd -ltermcap -ltelnet -L ../libtelnet
+LDLIBS = -lncurses -L ../libtelnet -ltelnet
 
 telnet: authenc.o commands.o main.o network.o ring.o sys_bsd.o telnet.o \
 		terminal.o tn3270.o utilities.o
 
 install: telnet
-	install -s telnet /usr/bin/x25telnet
+	install -s telnet /usr/local/bin/x25telnet
 
 clean:
 	rm -f *.o telnet
diff -urN x25-utils-2.1.20/telnet/sys_bsd.c x25_utils-2.3.91/telnet/sys_bsd.c
--- x25-utils-2.1.20/telnet/sys_bsd.c	Mon May 23 11:11:50 1994
+++ x25_utils-2.3.91/telnet/sys_bsd.c	Fri Oct 20 17:07:34 2000
@@ -46,6 +46,7 @@
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/socket.h>
+#include <sys/ioctl.h>
 #include <signal.h>
 #include <errno.h>
 #include <arpa/telnet.h>
diff -urN x25-utils-2.1.20/telnetd/Makefile x25_utils-2.3.91/telnetd/Makefile
--- x25-utils-2.1.20/telnetd/Makefile	Mon Dec 16 13:06:31 1996
+++ x25_utils-2.3.91/telnetd/Makefile	Fri Oct 20 17:11:28 2000
@@ -1,12 +1,12 @@
 CFLAGS += '-DISSUE_FILE="/etc/issue.net"' -I.. \
-	-DTERMCAP -DUSE_TERMIO -DKLUDGELINEMODE -DDIAGNOSTICS
-LDLIBS = -lbsd -ltermcap -ltelnet -L ../libtelnet
-
+	-DTERMCAP -DUSE_TERMIO -DKLUDGELINEMODE -DDIAGNOSTICS 
+#LDLIBS = -lbsd -ltermcap -ltelnet -L ../libtelnet
+LDLIBS = -lncurses -L ../libtelnet -ltelnet
 telnetd: telnetd.o state.o termstat.o slc.o sys_term.o utility.o \
 		global.o authenc.o logwtmp.o
 
 install: telnetd
-	install -s -m744 telnetd /usr/sbin/x25.telnetd
+	install -s -m744 telnetd /usr/local/sbin/x25.telnetd
 
 clean:
 	rm -f *.o telnetd
diff -urN x25-utils-2.1.20/telnetd/logwtmp.c x25_utils-2.3.91/telnetd/logwtmp.c
--- x25-utils-2.1.20/telnetd/logwtmp.c	Thu Jul 28 11:04:16 1994
+++ x25_utils-2.3.91/telnetd/logwtmp.c	Fri Oct 20 16:26:34 2000
@@ -38,9 +38,12 @@
 #include <unistd.h>
 #include <utmp.h>
 
-
+#if 0 /* originally, it was like this */
 logwtmp(line, name, host)
 	char *line, *name, *host;
+#else /* for glibc2, by Henner Eisen */
+void logwtmp(const char *line, const char *name, const char *host)
+#endif
 {
 	struct utmp ut;
 	struct stat buf;
diff -urN x25-utils-2.1.20/telnetd/sys_term.c x25_utils-2.3.91/telnetd/sys_term.c
--- x25-utils-2.1.20/telnetd/sys_term.c	Thu Jul 28 11:21:19 1994
+++ x25_utils-2.3.91/telnetd/sys_term.c	Fri Oct 20 18:15:49 2000
@@ -1,3 +1,6 @@
+/* very ugly preliminary hack to make this compiling
+   and linking with glibc2. It still does not seem to work */
+#undef linux 
 /*
  * Copyright (c) 1989 Regents of the University of California.
  * All rights reserved.
diff -urN x25-utils-2.1.20/telnetd/telnetd.c x25_utils-2.3.91/telnetd/telnetd.c
--- x25-utils-2.1.20/telnetd/telnetd.c	Sun Dec 15 23:19:51 1996
+++ x25_utils-2.3.91/telnetd/telnetd.c	Fri Oct 20 17:53:56 2000
@@ -288,9 +288,9 @@
 		perror("accept");
 		exit(1);
 	    }
-	    (void) dup2(ns, 0);
-	    (void) close(ns);
-	    (void) close(s);
+	    (void) printf("%d\n",dup2(ns, 0));
+//	    (void) close(ns);
+//	    (void) close(s);
 
 	openlog("telnetd", LOG_PID | LOG_ODELAY, LOG_DAEMON);
 	fromlen = sizeof (from);
diff -urN x25-utils-2.1.20/trace/Changes x25_utils-2.3.91/trace/Changes
--- x25-utils-2.1.20/trace/Changes	Thu Jan  1 01:00:00 1970
+++ x25_utils-2.3.91/trace/Changes	Fri Oct 20 16:22:53 2000
@@ -0,0 +1,8 @@
+1998-09-01 Henner Eisen
+	- Added dumping of CallRequest/CallAccepted packets with
+	  extended (TOA/NPI) address format.
+	- -d option to suppress dumping of user data from Data
+	  packets.
+1998-10-15 Henner Eisen
+	- hexdump for call request packets
+	- changed socket type to AF_PACKET
diff -urN x25-utils-2.1.20/trace/Makefile x25_utils-2.3.91/trace/Makefile
--- x25-utils-2.1.20/trace/Makefile	Sun Jan 12 13:46:34 1997
+++ x25_utils-2.3.91/trace/Makefile	Fri Oct 20 18:32:04 2000
@@ -1,8 +1,8 @@
 x25trace: x25trace.o x25dump.o
 
 install: x25trace
-	install -s x25trace /usr/sbin
-	install x25trace.8 /usr/man/man8
+	install -s x25trace /usr/local/sbin
+	install x25trace.8 /usr/local/man/man8
 
 clean:
 	rm -f *.o x25trace
diff -urN x25-utils-2.1.20/trace/x25dump.c x25_utils-2.3.91/trace/x25dump.c
--- x25-utils-2.1.20/trace/x25dump.c	Sun Jan 12 13:52:37 1997
+++ x25_utils-2.3.91/trace/x25dump.c	Fri Oct 20 16:22:53 2000
@@ -39,28 +39,38 @@
 #define X25_FAC_PACKET_SIZE     0x42
 #define X25_FAC_WINDOW_SIZE     0x43
 
-static int  x25_ntoa(unsigned char *, char *, char *);
+static int  x25_ntoa(unsigned char *, char *, char *, int);
 static int  dump_facilities(unsigned char *, int);
 static char *clear_code(unsigned char);
 static char *reset_code(unsigned char);
 static char *restart_code(unsigned char);
 
-void x25_dump(unsigned char *data, int length, int hexdump)
+void x25_dump(unsigned char *data, int length, int dump_flags)
 {
-	char called[16], calling[16];
-	int len;
+	char called[256], calling[256], *toa="";
+	int len, A_bit, i;
 
-	fprintf(stdout, "X.25: LCI %3.3X : ", (data[0] & 0x0F) + data[1]);
+	fprintf(stdout, "X.25: LCI %3.3X : ", 256*(data[0] & 0x0F) + data[1]);
 
 	switch (data[2]) {
 	case CALL_REQUEST:
+		A_bit = data[0] & QBIT;
+		if(A_bit) toa="[TOA/NPI-addr]";
 		data   += 3;
 		length -= 3;
-		len = x25_ntoa(data, called, calling);
+		if( dump_flags & X25DUMP_HEXDUMP){
+			printf("[%d]",length);
+			for(i=0;i<length;i++){
+				printf(" %2.2x", data[i]);
+			}
+			printf("\n               ");
+		}
+		len = x25_ntoa(data, called, calling, A_bit);
 		if (len > 1)
-			fprintf(stdout, "CALL REQUEST - %s -> %s\n", calling, called);
+			fprintf(stdout, "CALL REQUEST%s - %s -> %s\n",
+				toa, calling, called);
 		else
-			fprintf(stdout, "CALL REQUEST\n");
+			fprintf(stdout, "CALL REQUEST%s\n",toa);
 		data   += len;
 		length -= len;
 		len = dump_facilities(data, length);
@@ -70,11 +80,14 @@
 		return;
 
 	case CALL_ACCEPTED:
+		A_bit = data[0] & QBIT;
+		if(A_bit) toa="[TOA/NPI-addr]";
 		data   += 3;
 		length -= 3;
-		len = x25_ntoa(data, called, calling);
+		len = x25_ntoa(data, called, calling,A_bit);
 		if (len > 1)
-			fprintf(stdout, "CALL ACCEPTED - %s -> %s\n", calling, called);
+			fprintf(stdout, "CALL ACCEPTED%s - %s -> %s\n",
+				toa, calling, called);
 		else
 			fprintf(stdout, "CALL ACCEPTED\n");
 		data   += len;
@@ -100,7 +113,7 @@
 
 	case INTERRUPT:
 		fprintf(stdout, "INTERRUPT\n");
-		data_dump(data + 3, length - 3, hexdump);
+		data_dump(data + 3, length - 3, dump_flags);
 		return;
 
 	case INTERRUPT_CONFIRMATION:
@@ -142,7 +155,9 @@
 			(data[0] & QBIT) ? "Q" : "",
 			(data[0] & DBIT) ? "D" : "",
 			(data[2] & MBIT) ? "M" : "");
-		data_dump(data + 3, length - 3, hexdump);
+		if(dump_flags & X25DUMP_DATA){
+			data_dump(data + 3, length - 3, dump_flags);
+		}
 		return;
 	}
 
@@ -238,14 +253,18 @@
 	return buffer;
 }
 
-static int x25_ntoa(unsigned char *p, char *called, char *calling)
+static int x25_ntoa(unsigned char *p, char *called, char *calling, int A_bit)
 {
 	int called_len, calling_len;
 	int i;
 
-	called_len  = (*p >> 0) & 0x0F;
-	calling_len = (*p >> 4) & 0x0F;
-
+	if(A_bit == 0){
+		called_len  = (*p >> 0) & 0x0F;
+		calling_len = (*p >> 4) & 0x0F;
+	} else {
+		called_len  = *p++;
+		calling_len = *p;
+	}
 	p++;
 
 	for (i = 0; i < (called_len + calling_len); i++) {
diff -urN x25-utils-2.1.20/trace/x25trace.8 x25_utils-2.3.91/trace/x25trace.8
--- x25-utils-2.1.20/trace/x25trace.8	Sun Jan 12 13:58:19 1997
+++ x25_utils-2.3.91/trace/x25trace.8	Fri Oct 20 16:22:53 2000
@@ -1,8 +1,8 @@
-.TH X25TRACE 8 "13 January 1997" Linux "Linux System Managers Manual"
+.TH X25TRACE 8 "9 September 1998" Linux "Linux System Managers Manual"
 .SH NAME
 x25trace \- Monitor X.25 packet layer packets.
 .SH SYNOPSIS
-.B x25trace [-h]
+.B x25trace [-hd]
 .SH DESCRIPTION
 .LP
 .B X25trace
@@ -14,6 +14,9 @@
 .BI \-h
 Dump the user data in hexadecimal and text as opposed to the default of
 purely text.
+.TP 5
+.BI \-d
+Suppress dumping of user data from ordinary data packets.
 .SH "SEE ALSO"
 .BR ifconfig (8),
 .BR x25route (8).
@@ -23,4 +26,5 @@
 packets with extended sequence numbers. It only displays a subset of
 facilities.
 .SH AUTHOR
-Jonathan Naylor G4KLX <jsn@cs.nott.ac.uk>
+Jonathan Naylor G4KLX <jsn@cs.nott.ac.uk>, modified by Henner Eisen
+<eis@baty.hanse.de>.
diff -urN x25-utils-2.1.20/trace/x25trace.c x25_utils-2.3.91/trace/x25trace.c
--- x25-utils-2.1.20/trace/x25trace.c	Sun Jan 12 13:48:25 1997
+++ x25_utils-2.3.91/trace/x25trace.c	Fri Oct 20 16:22:53 2000
@@ -17,24 +17,27 @@
 {
 	unsigned char buffer[1500];
 	unsigned int size;
-	int hexdump = 0;
+	int dump_flags = X25DUMP_DATA;
 	int s;
 	struct sockaddr sa;
 	int asize;
 
-	while ((s = getopt(argc, argv, "h")) != -1) {
+	while ((s = getopt(argc, argv, "hd")) != -1) {
 		switch (s) {
 			case 'h':
-				hexdump = 1;
+				dump_flags ^= X25DUMP_HEXDUMP;
+				break;
+			case 'd':
+				dump_flags &= ~X25DUMP_DATA;
 				break;
 			case ':':
 			case '?':
-				fprintf(stderr, "Usage: x25trace [-h]\n");
+				fprintf(stderr, "Usage: x25trace [-h] [-d]\n");
 				return 1;
 		}
 	}
 
-	if ((s = socket(AF_INET, SOCK_PACKET, htons(ETH_P_X25))) == -1) {
+	if ((s = socket(AF_PACKET, SOCK_PACKET, htons(ETH_P_X25))) == -1) {
 		perror("x25trace: socket");
 		return 1;
 	}
@@ -50,7 +53,7 @@
 		switch (buffer[0]) {
 			case 0x00:
 				fprintf(stdout, "Port: %s\n", sa.sa_data);
-				x25_dump(buffer + 1, size - 1, hexdump);
+				x25_dump(buffer + 1, size - 1, dump_flags);
 				break;
 			case 0x01:
 				fprintf(stdout, "Port: %s - Connection Established\n", sa.sa_data);
@@ -131,9 +134,9 @@
 	}
 }
 
-void data_dump(unsigned char *data, int length, int hexdump)
+void data_dump(unsigned char *data, int length, int dump_flags)
 {
-	if (hexdump)
+	if (dump_flags & X25DUMP_HEXDUMP)
 		hex_dump(data, length);
 	else
 		ascii_dump(data, length);
diff -urN x25-utils-2.1.20/trace/x25trace.h x25_utils-2.3.91/trace/x25trace.h
--- x25-utils-2.1.20/trace/x25trace.h	Sun Dec 15 00:13:07 1996
+++ x25_utils-2.3.91/trace/x25trace.h	Fri Oct 20 16:22:53 2000
@@ -3,3 +3,6 @@
 
 /* In x25dump.c */
 void x25_dump(unsigned char *, int, int);
+
+#define X25DUMP_HEXDUMP 1 << 0	/* dump in hex format */
+#define X25DUMP_DATA	1 << 1	/* dump contents of N_Data packets */
