If we get an EOF on stdin, close the write side of the TCP connection, but
wait for the remote host to close the connection before exiting.
This commit is contained in:
parent
9ef98cf188
commit
451c744306
|
@ -31,7 +31,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)externs.h 8.1 (Berkeley) 6/6/93
|
||||
* $Id: externs.h,v 1.4 1994/12/24 17:50:05 cgd Exp $
|
||||
* $Id: externs.h,v 1.5 1995/03/17 18:03:06 mycroft Exp $
|
||||
*/
|
||||
|
||||
#ifndef BSD
|
||||
|
@ -146,7 +146,8 @@ extern int
|
|||
#endif /* defined(TN3270) */
|
||||
termdata, /* Print out terminal data flow */
|
||||
#endif /* defined(unix) */
|
||||
debug; /* Debug level */
|
||||
debug, /* Debug level */
|
||||
clienteof; /* Client received EOF */
|
||||
|
||||
extern cc_t escape; /* Escape to command mode */
|
||||
extern cc_t rlogin; /* Rlogin mode escape character */
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#ifndef lint
|
||||
/* from: static char sccsid[] = "@(#)sys_bsd.c 8.1 (Berkeley) 6/6/93"; */
|
||||
static char *rcsid = "$Id: sys_bsd.c,v 1.5 1994/02/25 03:00:39 cgd Exp $";
|
||||
static char *rcsid = "$Id: sys_bsd.c,v 1.6 1995/03/17 18:03:08 mycroft Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
|
@ -1138,15 +1138,20 @@ process_rings(netin, netout, netex, ttyin, ttyout, poll)
|
|||
if (c < 0 && errno == EWOULDBLOCK) {
|
||||
c = 0;
|
||||
} else {
|
||||
/* EOF detection for line mode!!!! */
|
||||
if ((c == 0) && MODE_LOCAL_CHARS(globalmode) && isatty(tin)) {
|
||||
/* must be an EOF... */
|
||||
*ttyiring.supply = termEofChar;
|
||||
c = 1;
|
||||
}
|
||||
if (c <= 0) {
|
||||
if (c < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (c == 0) {
|
||||
/* must be an EOF... */
|
||||
if (MODE_LOCAL_CHARS(globalmode) && isatty(tin)) {
|
||||
*ttyiring.supply = termEofChar;
|
||||
c = 1;
|
||||
} else {
|
||||
clienteof = 1;
|
||||
shutdown(net, 1);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (termdata) {
|
||||
Dump('<', ttyiring.supply, c);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#ifndef lint
|
||||
/* from: static char sccsid[] = "@(#)telnet.c 8.1 (Berkeley) 6/6/93"; */
|
||||
static char *rcsid = "$Id: telnet.c,v 1.3 1994/02/25 03:00:46 cgd Exp $";
|
||||
static char *rcsid = "$Id: telnet.c,v 1.4 1995/03/17 18:03:10 mycroft Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -105,7 +105,8 @@ int
|
|||
donelclchars, /* the user has set "localchars" */
|
||||
donebinarytoggle, /* the user has put us in binary */
|
||||
dontlecho, /* do we suppress local echoing right now? */
|
||||
globalmode;
|
||||
globalmode,
|
||||
clienteof = 0;
|
||||
|
||||
char *prompt = 0;
|
||||
|
||||
|
@ -2098,9 +2099,9 @@ Scheduler(block)
|
|||
ttyout = ring_full_count(&ttyoring);
|
||||
|
||||
#if defined(TN3270)
|
||||
ttyin = ring_empty_count(&ttyiring) && (shell_active == 0);
|
||||
ttyin = ring_empty_count(&ttyiring) && (clienteof == 0) && (shell_active == 0);
|
||||
#else /* defined(TN3270) */
|
||||
ttyin = ring_empty_count(&ttyiring);
|
||||
ttyin = ring_empty_count(&ttyiring) && (clienteof == 0);
|
||||
#endif /* defined(TN3270) */
|
||||
|
||||
#if defined(TN3270)
|
||||
|
|
Loading…
Reference in New Issue