From 0da1a7905bb03d899c94b3d3d9b25c9e61698390 Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 31 Mar 2003 12:10:08 +0000 Subject: [PATCH] pterm.c now relies on backend `exitcode' functions returning <0 when the session is still connected, and not returning an exit code until after it's finished. git-svn-id: svn://svn.tartarus.org/sgt/putty@3033 cda61777-01e9-0310-a592-d414129be87e --- raw.c | 8 ++++++-- rlogin.c | 9 ++++++--- telnet.c | 9 ++++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/raw.c b/raw.c index 53a8fc3a..9eb2286c 100644 --- a/raw.c +++ b/raw.c @@ -217,8 +217,12 @@ static void raw_provide_logctx(void *handle, void *logctx) static int raw_exitcode(void *handle) { - /* Exit codes are a meaningless concept in the Raw protocol */ - return 0; + Raw raw = (Raw) handle; + if (raw->s != NULL) + return -1; /* still connected */ + else + /* Exit codes are a meaningless concept in the Raw protocol */ + return 0; } Backend raw_backend = { diff --git a/rlogin.c b/rlogin.c index c3ef25c9..8e73ec91 100644 --- a/rlogin.c +++ b/rlogin.c @@ -284,9 +284,12 @@ static void rlogin_provide_logctx(void *handle, void *logctx) static int rlogin_exitcode(void *handle) { - /* Rlogin rlogin = (Rlogin) handle; */ - /* If we ever implement RSH, we'll probably need to do this properly */ - return 0; + Rlogin rlogin = (Rlogin) handle; + if (rlogin->s != NULL) + return -1; /* still connected */ + else + /* If we ever implement RSH, we'll probably need to do this properly */ + return 0; } Backend rlogin_backend = { diff --git a/telnet.c b/telnet.c index 28d696d3..6f6deaea 100644 --- a/telnet.c +++ b/telnet.c @@ -996,9 +996,12 @@ static void telnet_provide_logctx(void *handle, void *logctx) static int telnet_exitcode(void *handle) { - /* Telnet telnet = (Telnet) handle; */ - /* Telnet doesn't transmit exit codes back to the client */ - return 0; + Telnet telnet = (Telnet) handle; + if (telnet->s != NULL) + return -1; /* still connected */ + else + /* Telnet doesn't transmit exit codes back to the client */ + return 0; } Backend telnet_backend = { -- 2.11.0