Module Name:    src
Committed By:   maya
Date:           Thu Dec 13 04:49:19 UTC 2018

Modified Files:
        src/usr.bin/telnet: Makefile commands.c defines.h externs.h main.c
            sys_bsd.c telnet.c utilities.c
Removed Files:
        src/usr.bin/telnet: tn3270.c

Log Message:
unifdef TN3270 which is never defined (and wouldn't build if it was)
delete tn3270 file no longer needed.
SetIn3270(); expands to nothing now, so remove it.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/usr.bin/telnet/Makefile
cvs rdiff -u -r1.70 -r1.71 src/usr.bin/telnet/commands.c
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/telnet/defines.h
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/telnet/externs.h
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/telnet/main.c
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/telnet/sys_bsd.c
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/telnet/telnet.c
cvs rdiff -u -r1.22 -r0 src/usr.bin/telnet/tn3270.c
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/telnet/utilities.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/telnet/Makefile
diff -u src/usr.bin/telnet/Makefile:1.53 src/usr.bin/telnet/Makefile:1.54
--- src/usr.bin/telnet/Makefile:1.53	Sun Feb 25 00:16:49 2018
+++ src/usr.bin/telnet/Makefile	Thu Dec 13 04:49:19 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.53 2018/02/25 00:16:49 mrg Exp $
+#	$NetBSD: Makefile,v 1.54 2018/12/13 04:49:19 maya Exp $
 #
 # Copyright (c) 1990 The Regents of the University of California.
 # All rights reserved.
@@ -50,7 +50,7 @@ LDADD+= -lterminfo ${LIBTELNETDIR}/libte
 DPADD+=	${LIBTERMINFO} ${LIBTELNETDIR}/libtelnet.a
 
 SRCS=	authenc.c commands.c main.c network.c ring.c sys_bsd.c telnet.c \
-	terminal.c tn3270.c utilities.c
+	terminal.c utilities.c
 
 CPPFLAGS+=-I${NETBSDSRCDIR}/lib
 CPPFLAGS+=-DIPSEC

Index: src/usr.bin/telnet/commands.c
diff -u src/usr.bin/telnet/commands.c:1.70 src/usr.bin/telnet/commands.c:1.71
--- src/usr.bin/telnet/commands.c:1.70	Tue Oct  4 14:36:11 2016
+++ src/usr.bin/telnet/commands.c	Thu Dec 13 04:49:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: commands.c,v 1.70 2016/10/04 14:36:11 joerg Exp $	*/
+/*	$NetBSD: commands.c,v 1.71 2018/12/13 04:49:19 maya Exp $	*/
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = "@(#)commands.c	8.4 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: commands.c,v 1.70 2016/10/04 14:36:11 joerg Exp $");
+__RCSID("$NetBSD: commands.c,v 1.71 2018/12/13 04:49:19 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -160,9 +160,6 @@ static struct envlist *getenvcmd(char *)
 #ifdef AUTHENTICATION
 static int auth_help(char *);
 #endif
-#ifdef TN3270
-static void filestuff(int);
-#endif
 static int status(int, char *[]);
 static const char *sockaddr_ntop (struct sockaddr *);
 typedef int (*intrtn_t)(int, char **);
@@ -743,18 +740,6 @@ static struct togglelist Togglelist[] = 
 		&localchars,
 		    "recognize certain control characters" },
     { " ", "", 0, NULL, NULL },		/* empty line */
-#ifdef TN3270
-    { "apitrace",
-	"(debugging) toggle tracing of API transactions",
-	    0,
-		&apitrace,
-		    "trace API transactions" },
-    { "cursesdata",
-	"(debugging) toggle printing of hexadecimal curses data",
-	    0,
-		&cursesdata,
-		    "print hexadecimal representation of curses data" },
-#endif	/* defined(TN3270) */
     { "debug",
 	"debugging",
 	    togdebug,
@@ -1355,7 +1340,6 @@ suspend(int argc, char *argv[])
     return 1;
 }
 
-#ifndef TN3270
 /*ARGSUSED*/
 int
 shell(int argc, char *argv[])
@@ -1403,7 +1387,6 @@ shell(int argc, char *argv[])
     }
     return 1;
 }
-#endif	/* !defined(TN3270) */
 
 /*VARARGS*/
 static int
@@ -1422,9 +1405,6 @@ bye(int  argc, char *argv[])
 #endif	/* defined(AUTHENTICATION) */
 	/* reset options */
 	tninit();
-#ifdef TN3270
-	SetIn3270();		/* Get out of 3270 mode */
-#endif	/* defined(TN3270) */
     }
     if ((argc != 2) || (strcmp(argv[1], "fromquit") != 0)) {
 	longjmp(toplevel, 1);
@@ -2035,35 +2015,6 @@ encrypt_cmd(int argc, char *argv[])
 }
 #endif	/* ENCRYPTION */
 
-#ifdef TN3270
-static void
-filestuff(int fd)
-{
-    int res;
-
-    setconnmode(0);
-    res = fcntl(fd, F_GETOWN, 0);
-    setcommandmode();
-
-    if (res == -1) {
-	perror("fcntl");
-	return;
-    }
-    printf("\tOwner is %d.\n", res);
-
-    setconnmode(0);
-    res = fcntl(fd, F_GETFL, 0);
-    setcommandmode();
-
-    if (res == -1) {
-	perror("fcntl");
-	return;
-    }
-#ifdef notdef
-    printf("\tFlags are 0x%x: %s\n", res, decodeflags(res));
-#endif
-}
-#endif /* defined(TN3270) */
 
 /*
  * Print status about the connection.
@@ -2102,35 +2053,8 @@ status(int argc, char *argv[])
     } else {
 	printf("No connection.\n");
     }
-#   ifndef TN3270
     printf("Escape character is '%s'.\n", control(escape));
     (void) fflush(stdout);
-#   else /* !defined(TN3270) */
-    if ((!In3270) && ((argc < 2) || strcmp(argv[1], "notmuch"))) {
-	printf("Escape character is '%s'.\n", control(escape));
-    }
-    if ((argc >= 2) && !strcmp(argv[1], "everything")) {
-	printf("SIGIO received %d time%s.\n",
-				sigiocount, (sigiocount == 1)? "":"s");
-	if (In3270) {
-	    printf("Process ID %d, process group %d.\n",
-					    getpid(), getpgrp());
-	    printf("Terminal input:\n");
-	    filestuff(tin);
-	    printf("Terminal output:\n");
-	    filestuff(tout);
-	    printf("Network socket:\n");
-	    filestuff(net);
-	}
-    }
-    if (In3270 && transcom) {
-	printf("Transparent mode command is '%s'.\n", transcom);
-    }
-    (void) fflush(stdout);
-    if (In3270) {
-	return 0;
-    }
-#   endif /* defined(TN3270) */
     return 1;
 }
 
@@ -2384,9 +2308,6 @@ static char
 	togglestring[] ="toggle operating parameters ('toggle ?' for more)",
 	slchelp[] =	"change state of special characters ('slc ?' for more)",
 	displayhelp[] =	"display operating parameters",
-#ifdef TN3270
-	transcomhelp[] = "specify Unix command for transparent mode pipe",
-#endif	/* defined(TN3270) */
 #ifdef AUTHENTICATION
 	authhelp[] =	"turn on (off) authentication ('auth ?' for more)",
 #endif
@@ -2411,9 +2332,6 @@ static Command cmdtab[] = {
 	{ "status",	statushelp,	status,		0 },
 	{ "toggle",	togglestring,	toggle,		0 },
 	{ "slc",	slchelp,	slccmd,		0 },
-#ifdef TN3270
-	{ "transcom",	transcomhelp,	settranscom,	0 },
-#endif	/* defined(TN3270) */
 #ifdef AUTHENTICATION
 	{ "auth",	authhelp,	auth_cmd,	0 },
 #endif
@@ -2421,11 +2339,7 @@ static Command cmdtab[] = {
 	{ "encrypt",	encrypthelp,	encrypt_cmd,	0 },
 #endif
 	{ "z",		zhelp,		suspend,	0 },
-#ifdef TN3270
-	{ "!",		shellhelp,	shell,		1 },
-#else
 	{ "!",		shellhelp,	shell,		0 },
-#endif
 	{ "environ",	envhelp,	env_cmd,	0 },
 	{ "?",		helphelp,	help,		0 },
 	{ NULL,		NULL,		NULL,		0 }
@@ -2503,9 +2417,6 @@ command(int top, const char *tbuf, int c
 	getline:
 	    if (rlogin != _POSIX_VDISABLE)
 		printf("%s> ", prompt);
-#ifdef TN3270
-	    fflush(stdout);
-#endif
 	    if (fgets(line, sizeof(line), stdin) == NULL) {
 		if (feof(stdin) || ferror(stdin)) {
 		    (void) quit(0, NULL);
@@ -2542,13 +2453,7 @@ command(int top, const char *tbuf, int c
 	    longjmp(toplevel, 1);
 	    /*NOTREACHED*/
 	}
-#ifdef TN3270
-	if (shell_active == 0) {
-	    setconnmode(0);
-	}
-#else	/* defined(TN3270) */
 	setconnmode(0);
-#endif	/* defined(TN3270) */
     }
 }
 

Index: src/usr.bin/telnet/defines.h
diff -u src/usr.bin/telnet/defines.h:1.8 src/usr.bin/telnet/defines.h:1.9
--- src/usr.bin/telnet/defines.h:1.8	Thu Aug  7 11:16:09 2003
+++ src/usr.bin/telnet/defines.h	Thu Dec 13 04:49:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: defines.h,v 1.8 2003/08/07 11:16:09 agc Exp $	*/
+/*	$NetBSD: defines.h,v 1.9 2018/12/13 04:49:19 maya Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -33,12 +33,6 @@
 
 #define	settimer(x)	clocks.x = clocks.system++
 
-#ifndef TN3270
-
-#define	SetIn3270()
-
-#endif	/* !defined(TN3270) */
-
 #define	NETADD(c)	{ *netoring.supply = (c); ring_supplied(&netoring, 1); }
 #define	NET2ADD(c1,c2)	{ NETADD((c1)); NETADD((c2)); }
 #define	NETBYTES()	(ring_full_count(&netoring))

Index: src/usr.bin/telnet/externs.h
diff -u src/usr.bin/telnet/externs.h:1.38 src/usr.bin/telnet/externs.h:1.39
--- src/usr.bin/telnet/externs.h:1.38	Tue Oct  4 14:35:38 2016
+++ src/usr.bin/telnet/externs.h	Thu Dec 13 04:49:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.38 2016/10/04 14:35:38 joerg Exp $	*/
+/*	$NetBSD: externs.h,v 1.39 2018/12/13 04:49:19 maya Exp $	*/
 
 /*
  * Copyright (c) 1988, 1990, 1993
@@ -90,10 +90,6 @@ extern int
     crmod,
     netdata,		/* Print out network data flow */
     prettydump,		/* Print "netdata" output in user readable format */
-#ifdef TN3270
-    cursesdata,		/* Print out curses data flow */
-    apitrace,		/* Trace API transactions */
-#endif	/* defined(TN3270) */
     termdata,		/* Print out terminal data flow */
     telnet_debug,	/* Debug level */
     doaddrlookup,	/* do a reverse address lookup? */
@@ -371,42 +367,3 @@ extern struct	termios new_tc;
 # define termForw1Charp		&termForw1Char
 # define termForw2Charp		&termForw2Char
 # define termAytCharp		&termAytChar
-
-
-/* Tn3270 section */
-#if	defined(TN3270)
-
-extern int
-    HaveInput,		/* Whether an asynchronous I/O indication came in */
-    noasynchtty,	/* Don't do signals on I/O (SIGURG, SIGIO) */
-    noasynchnet,	/* Don't do signals on I/O (SIGURG, SIGIO) */
-    sigiocount,		/* Count of SIGIO receptions */
-    shell_active;	/* Subshell is active */
-
-extern char
-    *Ibackp,		/* Oldest byte of 3270 data */
-    Ibuf[],		/* 3270 buffer */
-    *Ifrontp,		/* Where next 3270 byte goes */
-    tline[200],
-    *transcom;		/* Transparent command */
-
-/* tn3270.c */
-void init_3270(void);
-int DataToNetwork(char *, int, int);
-void inputAvailable(int);
-void outputPurge(void);
-int DataToTerminal(char *, int);
-int Push3270(void);
-void Finish3270(void);
-void StringToTerminal(char *);
-int _putchar(int);
-void SetIn3270(void);
-int tn3270_ttype(void);
-int settranscom(int, char *[]);
-int shell_continue(void);
-int DataFromTerminal(char *, int);
-int DataFromNetwork(char *, int, int);
-void ConnectScreen(void);
-int DoTerminalOutput(void);
-
-#endif	/* defined(TN3270) */

Index: src/usr.bin/telnet/main.c
diff -u src/usr.bin/telnet/main.c:1.30 src/usr.bin/telnet/main.c:1.31
--- src/usr.bin/telnet/main.c:1.30	Mon Sep  5 00:40:30 2016
+++ src/usr.bin/telnet/main.c	Thu Dec 13 04:49:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.30 2016/09/05 00:40:30 sevan Exp $	*/
+/*	$NetBSD: main.c,v 1.31 2018/12/13 04:49:19 maya Exp $	*/
 
 /*
  * Copyright (c) 1988, 1990, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.30 2016/09/05 00:40:30 sevan Exp $");
+__RCSID("$NetBSD: main.c,v 1.31 2018/12/13 04:49:19 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -84,9 +84,6 @@ tninit(void)
 
     init_sys();
 
-#ifdef TN3270
-    init_3270();
-#endif
 }
 
 	void
@@ -101,15 +98,7 @@ usage(void)
 	    "[-4] [-6] [-8] [-E] [-L] [-N] [-S tos] [-a] [-c] [-d] [-e char]",
 	    "\n\t[-l user] [-n tracefile] ",
 #endif
-#ifdef TN3270
-# ifdef AUTHENTICATION
-	    "[-noasynch] [-noasynctty]\n\t[-noasyncnet] [-r] [-t transcom] ",
-# else
-	    "[-noasynch] [-noasynctty] [-noasyncnet] [-r]\n\t[-t transcom]",
-# endif
-#else
 	    "[-r] ",
-#endif
 #ifdef	ENCRYPTION
 	    "[-x] "
 #endif
@@ -251,33 +240,15 @@ main(int argc, char *argv[])
 			user = optarg;
 			break;
 		case 'n':
-#ifdef TN3270
-			/* distinguish between "-n oasynch" and "-noasynch" */
-			if (argv[optind - 1][0] == '-' && argv[optind - 1][1]
-			    == 'n' && argv[optind - 1][2] == 'o') {
-				if (!strcmp(optarg, "oasynch")) {
-					noasynchtty = 1;
-					noasynchnet = 1;
-				} else if (!strcmp(optarg, "oasynchtty"))
-					noasynchtty = 1;
-				else if (!strcmp(optarg, "oasynchnet"))
-					noasynchnet = 1;
-			} else
-#endif	/* defined(TN3270) */
 				SetNetTrace(optarg);
 			break;
 		case 'r':
 			rlogin = '~';
 			break;
 		case 't':
-#ifdef TN3270
-			(void)strlcpy(tline, optarg, sizeof(tline));
-			transcom = tline;
-#else
 			fprintf(stderr,
 			   "%s: Warning: -t ignored, no TN3270 support.\n",
 								prompt);
-#endif
 			break;
 		case 'x':
 #ifdef	ENCRYPTION
@@ -349,11 +320,6 @@ main(int argc, char *argv[])
 	}
 	(void)setjmp(toplevel);
 	for (;;) {
-#ifdef TN3270
-		if (shell_active)
-			shell_continue();
-		else
-#endif
 			command(1, 0, 0);
 	}
 }

Index: src/usr.bin/telnet/sys_bsd.c
diff -u src/usr.bin/telnet/sys_bsd.c:1.34 src/usr.bin/telnet/sys_bsd.c:1.35
--- src/usr.bin/telnet/sys_bsd.c:1.34	Sun Feb  4 09:01:12 2018
+++ src/usr.bin/telnet/sys_bsd.c	Thu Dec 13 04:49:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_bsd.c,v 1.34 2018/02/04 09:01:12 mrg Exp $	*/
+/*	$NetBSD: sys_bsd.c,v 1.35 2018/12/13 04:49:19 maya Exp $	*/
 
 /*
  * Copyright (c) 1988, 1990, 1993
@@ -34,7 +34,7 @@
 #if 0
 from: static char sccsid[] = "@(#)sys_bsd.c	8.4 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: sys_bsd.c,v 1.34 2018/02/04 09:01:12 mrg Exp $");
+__RCSID("$NetBSD: sys_bsd.c,v 1.35 2018/12/13 04:49:19 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -453,11 +453,6 @@ TerminalNewMode(int f)
 
     ioctl(tin, FIONBIO, (char *)&onoff);
     ioctl(tout, FIONBIO, (char *)&onoff);
-#if	defined(TN3270)
-    if (noasynchtty == 0) {
-	ioctl(tin, FIOASYNC, (char *)&onoff);
-    }
-#endif	/* defined(TN3270) */
 
 }
 
@@ -502,22 +497,6 @@ NetNonblockingIO(int fd, int onoff)
     ioctl(fd, FIONBIO, (char *)&onoff);
 }
 
-#ifdef TN3270
-void
-NetSigIO(int fd, int onoff)
-{
-    ioctl(fd, FIOASYNC, (char *)&onoff);	/* hear about input */
-}
-
-void
-NetSetPgrp(int fd)
-{
-    int myPid;
-
-    myPid = getpid();
-    fcntl(fd, F_SETOWN, myPid);
-}
-#endif	/*defined(TN3270)*/
 
 /*
  * Various signal handling routines.
@@ -594,12 +573,6 @@ sys_telnet_init(void)
 
     NetNonblockingIO(net, 1);
 
-#ifdef TN3270
-    if (noasynchnet == 0) {			/* DBX can't handle! */
-	NetSigIO(net, 1);
-	NetSetPgrp(net);
-    }
-#endif	/* defined(TN3270) */
 
     if (SetSockOpt(net, SOL_SOCKET, SO_OOBINLINE, 1) == -1) {
 	perror("SetSockOpt");
@@ -649,14 +622,6 @@ process_rings(int netin, int netout, int
 	    if (errno == EINTR) {
 		return 0;
 	    }
-#ifdef TN3270
-		    /*
-		     * we can get EBADF if we were in transparent
-		     * mode, and the transcom process died.
-		    */
-	    if (errno == EBADF)
-		return 0;
-#endif /* defined(TN3270) */
 		    /* I don't like this, does it ever happen? */
 	    printf("sleep(5) from telnet, after poll\r\n");
 	    sleep(5);

Index: src/usr.bin/telnet/telnet.c
diff -u src/usr.bin/telnet/telnet.c:1.37 src/usr.bin/telnet/telnet.c:1.38
--- src/usr.bin/telnet/telnet.c:1.37	Wed Dec 12 19:05:32 2018
+++ src/usr.bin/telnet/telnet.c	Thu Dec 13 04:49:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: telnet.c,v 1.37 2018/12/12 19:05:32 maya Exp $	*/
+/*	$NetBSD: telnet.c,v 1.38 2018/12/13 04:49:19 maya Exp $	*/
 
 /*
  * Copyright (c) 1988, 1990, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)telnet.c	8.4 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: telnet.c,v 1.37 2018/12/12 19:05:32 maya Exp $");
+__RCSID("$NetBSD: telnet.c,v 1.38 2018/12/13 04:49:19 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -97,11 +97,6 @@ int
 	crmod,
 	netdata,	/* Print out network data flow */
 	crlf,		/* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */
-#ifdef TN3270
-	noasynchtty = 0,/* User specified "-noasynch" on command line */
-	noasynchnet = 0,/* User specified "-noasynch" on command line */
-	askedSGA = 0,	/* We have talked about suppress go ahead */
-#endif	/* defined(TN3270) */
 	telnetport,
 	SYNCHing,	/* we are in TELNET SYNCH mode */
 	flushout,	/* flush output */
@@ -346,30 +341,6 @@ willoption(int option)
 	    switch (option) {
 
 	    case TELOPT_ECHO:
-#	    if defined(TN3270)
-		/*
-		 * The following is a pain in the rear-end.
-		 * Various IBM servers (some versions of Wiscnet,
-		 * possibly Fibronics/Spartacus, and who knows who
-		 * else) will NOT allow us to send "DO SGA" too early
-		 * in the setup proceedings.  On the other hand,
-		 * 4.2 servers (telnetd) won't set SGA correctly.
-		 * So, we are stuck.  Empirically (but, based on
-		 * a VERY small sample), the IBM servers don't send
-		 * out anything about ECHO, so we postpone our sending
-		 * "DO SGA" until we see "WILL ECHO" (which 4.2 servers
-		 * DO send).
-		  */
-		{
-		    if (askedSGA == 0) {
-			askedSGA = 1;
-			if (my_want_state_is_dont(TELOPT_SGA))
-			    send_do(TELOPT_SGA, 1);
-		    }
-		}
-		    /* Fall through */
-	    case TELOPT_EOR:
-#endif	    /* defined(TN3270) */
 	    case TELOPT_BINARY:
 	    case TELOPT_SGA:
 		settimer(modenegotiated);
@@ -490,9 +461,6 @@ dooption(int option)
 		set_my_state_wont(TELOPT_TM);
 		return;
 
-#	if defined(TN3270)
-	    case TELOPT_EOR:		/* end of record */
-#	endif	/* defined(TN3270) */
 	    case TELOPT_BINARY:		/* binary mode */
 	    case TELOPT_NAWS:		/* window size */
 	    case TELOPT_TSPEED:		/* terminal speed */
@@ -848,11 +816,6 @@ suboption(void)
 	    unsigned char temp[50];
 	    int len;
 
-#ifdef TN3270
-	    if (tn3270_ttype()) {
-		return;
-	    }
-#endif	/* defined(TN3270) */
 	    name = gettermname();
 	    len = strlen(name) + 4 + 2;
 	    if (len < NETROOM()) {
@@ -1772,23 +1735,6 @@ telrcv(void)
 		telrcv_state = TS_IAC;
 		break;
 	    }
-#	    if defined(TN3270)
-	    if (In3270) {
-		*Ifrontp++ = c;
-		while (scc > 0) {
-		    c = *sbp++ & 0377, scc--; count++;
-#ifdef	ENCRYPTION
-		    if (decrypt_input)
-			c = (*decrypt_input)(c);
-#endif	/* ENCRYPTION */
-		    if (c == IAC) {
-			telrcv_state = TS_IAC;
-			break;
-		    }
-		    *Ifrontp++ = c;
-		}
-	    } else
-#	    endif /* defined(TN3270) */
 		    /*
 		     * The 'crmod' hack (see following) is needed
 		     * since we can't * set CRMOD on output only.
@@ -1872,31 +1818,9 @@ process_iac:
 		telrcv_state = TS_SB;
 		continue;
 
-#	    if defined(TN3270)
-	    case EOR:
-		if (In3270) {
-		    if (Ibackp == Ifrontp) {
-			Ibackp = Ifrontp = Ibuf;
-			ISend = 0;	/* should have been! */
-		    } else {
-			Ibackp += DataFromNetwork(Ibackp, Ifrontp-Ibackp, 1);
-			ISend = 1;
-		    }
-		}
-		printoption("RCVD", IAC, EOR);
-		break;
-#	    endif /* defined(TN3270) */
 
 	    case IAC:
-#	    if !defined(TN3270)
 		TTYADD(IAC);
-#	    else /* !defined(TN3270) */
-		if (In3270) {
-		    *Ifrontp++ = IAC;
-		} else {
-		    TTYADD(IAC);
-		}
-#	    endif /* !defined(TN3270) */
 		break;
 
 	    case NOP:
@@ -1911,21 +1835,18 @@ process_iac:
 	case TS_WILL:
 	    printoption("RCVD", WILL, c);
 	    willoption(c);
-	    SetIn3270();
 	    telrcv_state = TS_DATA;
 	    continue;
 
 	case TS_WONT:
 	    printoption("RCVD", WONT, c);
 	    wontoption(c);
-	    SetIn3270();
 	    telrcv_state = TS_DATA;
 	    continue;
 
 	case TS_DO:
 	    printoption("RCVD", DO, c);
 	    dooption(c);
-	    SetIn3270();
 	    if (c == TELOPT_NAWS) {
 		sendnaws();
 	    } else if (c == TELOPT_LFLOW) {
@@ -1941,7 +1862,6 @@ process_iac:
 	    dontoption(c);
 	    flushline = 1;
 	    setconnmode(0);	/* set new tty mode (maybe) */
-	    SetIn3270();
 	    telrcv_state = TS_DATA;
 	    continue;
 
@@ -1975,7 +1895,6 @@ process_iac:
 
 		    printoption("In SUBOPTION processing, RCVD", IAC, c);
 		    suboption();	/* handle sub-option */
-		    SetIn3270();
 		    telrcv_state = TS_IAC;
 		    goto process_iac;
 		}
@@ -1987,7 +1906,6 @@ process_iac:
 		subpointer -= 2;
 		SB_TERM();
 		suboption();	/* handle sub-option */
-		SetIn3270();
 		telrcv_state = TS_DATA;
 	    }
 	}
@@ -2185,27 +2103,13 @@ Scheduler(int block)			/* should we bloc
 			my_want_state_is_will(TELOPT_BINARY));
     ttyout = ring_full_count(&ttyoring);
 
-#ifdef TN3270
-    ttyin = ring_empty_count(&ttyiring) && (clienteof == 0) && (shell_active == 0);
-#else	/* defined(TN3270) */
     ttyin = ring_empty_count(&ttyiring) && (clienteof == 0);
-#endif	/* defined(TN3270) */
 
-#ifdef TN3270
-    netin = ring_empty_count(&netiring);
-#   else /* !defined(TN3270) */
     netin = !ISend && ring_empty_count(&netiring);
-#   endif /* !defined(TN3270) */
 
     netex = !SYNCHing;
 
     /* If we have seen a signal recently, reset things */
-#   ifdef TN3270
-    if (HaveInput) {
-	HaveInput = 0;
-	(void) signal(SIGIO, inputAvailable);
-    }
-#endif	/* defined(TN3270) */
 
     /* Call to system code to process rings */
 
@@ -2214,30 +2118,11 @@ Scheduler(int block)			/* should we bloc
     /* Now, look at the input rings, looking for work to do. */
 
     if (ring_full_count(&ttyiring)) {
-#   if defined(TN3270)
-	if (In3270) {
-	    int c;
-
-	    c = DataFromTerminal(ttyiring.consume,
-					ring_full_consecutive(&ttyiring));
-	    if (c) {
-		returnValue = 1;
-		ring_consumed(&ttyiring, c);
-	    }
-	} else {
-#   endif /* defined(TN3270) */
 	    returnValue |= telsnd();
-#   if defined(TN3270)
-	}
-#   endif /* defined(TN3270) */
     }
 
     if (ring_full_count(&netiring)) {
-#	if !defined(TN3270)
 	returnValue |= telrcv();
-#	else /* !defined(TN3270) */
-	returnValue = Push3270();
-#	endif /* !defined(TN3270) */
     }
     return returnValue;
 }
@@ -2262,7 +2147,6 @@ telnet(const char *user)
 	auth_encrypt_user(user);
     }
 #endif	/* defined(AUTHENTICATION) || defined(ENCRYPTION) */
-#   if !defined(TN3270)
     if (telnetport) {
 #ifdef AUTHENTICATION
 	if (autologin)
@@ -2285,9 +2169,7 @@ telnet(const char *user)
 	if (eight)
 	    tel_enter_binary(eight);
     }
-#   endif /* !defined(TN3270) */
 
-#   if !defined(TN3270)
     for (;;) {
 	int schedValue;
 
@@ -2303,45 +2185,6 @@ telnet(const char *user)
 	    return;
 	}
     }
-#   else /* !defined(TN3270) */
-    for (;;) {
-	int schedValue;
-
-	while (!In3270 && !shell_active) {
-	    if (Scheduler(1) == -1) {
-		setcommandmode();
-		return;
-	    }
-	}
-
-	while ((schedValue = Scheduler(0)) != 0) {
-	    if (schedValue == -1) {
-		setcommandmode();
-		return;
-	    }
-	}
-		/* If there is data waiting to go out to terminal, don't
-		 * schedule any more data for the terminal.
-		 */
-	if (ring_full_count(&ttyoring)) {
-	    schedValue = 1;
-	} else {
-	    if (shell_active) {
-		if (shell_continue() == 0) {
-		    ConnectScreen();
-		}
-	    } else if (In3270) {
-		schedValue = DoTerminalOutput();
-	    }
-	}
-	if (schedValue && (shell_active == 0)) {
-	    if (Scheduler(1) == -1) {
-		setcommandmode();
-		return;
-	    }
-	}
-    }
-#   endif /* !defined(TN3270) */
 }
 
 #if	0	/* XXX - this not being in is a bug */

Index: src/usr.bin/telnet/utilities.c
diff -u src/usr.bin/telnet/utilities.c:1.24 src/usr.bin/telnet/utilities.c:1.25
--- src/usr.bin/telnet/utilities.c:1.24	Wed Dec 12 19:05:32 2018
+++ src/usr.bin/telnet/utilities.c	Thu Dec 13 04:49:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: utilities.c,v 1.24 2018/12/12 19:05:32 maya Exp $	*/
+/*	$NetBSD: utilities.c,v 1.25 2018/12/13 04:49:19 maya Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)utilities.c	8.3 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: utilities.c,v 1.24 2018/12/12 19:05:32 maya Exp $");
+__RCSID("$NetBSD: utilities.c,v 1.25 2018/12/13 04:49:19 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -55,9 +55,6 @@ __RCSID("$NetBSD: utilities.c,v 1.24 201
 #include "defines.h"
 #include "externs.h"
 
-#ifdef TN3270
-#include "../sys_curses/telextrn.h"
-#endif
 
 #ifdef AUTHENTICATION
 #include <libtelnet/auth.h>
@@ -886,24 +883,13 @@ void
 SetForExit(void)
 {
     setconnmode(0);
-#ifdef TN3270
-    if (In3270) {
-	Finish3270();
-    }
-#else	/* defined(TN3270) */
     do {
 	(void)telrcv();			/* Process any incoming data */
 	EmptyTerminal();
     } while (ring_full_count(&netiring));	/* While there is any */
-#endif	/* defined(TN3270) */
     setcommandmode();
     fflush(stdout);
     fflush(stderr);
-#ifdef TN3270
-    if (In3270) {
-	StopScreen(1);
-    }
-#endif	/* defined(TN3270) */
     setconnmode(0);
     EmptyTerminal();			/* Flush the path to the tty */
     setcommandmode();

Reply via email to