1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Add a configurable option to make Return in Telnet send an ordinary

^M instead of the Telnet New Line code. Unix-type telnetds don't
care one way or the other; RDB claims some telnetds prefer Telnet
NL; and now someone has found one that can't deal with Telnet NL and
prefers ^M. Sigh.

[originally from svn r1520]
This commit is contained in:
Simon Tatham 2001-12-29 17:21:26 +00:00
parent 69b15bcc90
commit 726f9dde7e
5 changed files with 38 additions and 3 deletions

View File

@ -1,4 +1,4 @@
\versionid $Id: config.but,v 1.22 2001/12/15 12:15:24 simon Exp $ \versionid $Id: config.but,v 1.23 2001/12/29 17:21:26 simon Exp $
\C{config} Configuring PuTTY \C{config} Configuring PuTTY
@ -1293,6 +1293,22 @@ the Telnet special backspace code, and Control-C will send the
Telnet special interrupt code. You probably shouldn't enable this Telnet special interrupt code. You probably shouldn't enable this
unless you know what you're doing. unless you know what you're doing.
\S{config-telnetkey} \q{Return key sends telnet New Line instead of ^M}
\cfg{winhelp-topic}{telnet.newline}
Unlike most other remote login protocols, the Telnet protocol has a
special \Q{new line} code that is not the same as the usual line
endings of Control-M or Control-J. By default, PuTTY sends the
Telnet New Line code when you press Return, instead of sending
Control-M as it does in most other protocols.
Most Unix-style Telnet servers don't mind whether they receive
Telnet New Line or Control-M; some servers do expect New Line, and
some servers prefer to see ^M. If you are seeing surprising
behaviour when you press Return in a Telnet session, you might try
turning this option off to see if it helps.
\H{config-rlogin} The Rlogin panel \H{config-rlogin} The Rlogin panel
The Rlogin panel allows you to configure options that only apply to The Rlogin panel allows you to configure options that only apply to

View File

@ -200,7 +200,7 @@ void ldisc_send(char *buf, int len, int interactive)
back->send(term_buf, term_buflen); back->send(term_buf, term_buflen);
if (cfg.protocol == PROT_RAW) if (cfg.protocol == PROT_RAW)
back->send("\r\n", 2); back->send("\r\n", 2);
else if (cfg.protocol == PROT_TELNET) else if (cfg.protocol == PROT_TELNET && cfg.telnet_newline)
back->special(TS_EOL); back->special(TS_EOL);
else else
back->send("\r", 1); back->send("\r", 1);
@ -237,7 +237,10 @@ void ldisc_send(char *buf, int len, int interactive)
if (keyflag && cfg.protocol == PROT_TELNET && len == 1) { if (keyflag && cfg.protocol == PROT_TELNET && len == 1) {
switch (buf[0]) { switch (buf[0]) {
case CTRL('M'): case CTRL('M'):
back->special(TS_EOL); if (cfg.protocol == PROT_TELNET && cfg.telnet_newline)
back->special(TS_EOL);
else
back->send("\r", 1);
break; break;
case CTRL('?'): case CTRL('?'):
case CTRL('H'): case CTRL('H'):

View File

@ -281,6 +281,7 @@ typedef struct {
int app_keypad; int app_keypad;
int nethack_keypad; int nethack_keypad;
int telnet_keyboard; int telnet_keyboard;
int telnet_newline;
int alt_f4; /* is it special? */ int alt_f4; /* is it special? */
int alt_space; /* is it special? */ int alt_space; /* is it special? */
int alt_only; /* is it special? */ int alt_only; /* is it special? */

View File

@ -198,6 +198,7 @@ void save_settings(char *section, int do_host, Config * cfg)
write_setting_i(sesskey, "ComposeKey", cfg->compose_key); write_setting_i(sesskey, "ComposeKey", cfg->compose_key);
write_setting_i(sesskey, "CtrlAltKeys", cfg->ctrlaltkeys); write_setting_i(sesskey, "CtrlAltKeys", cfg->ctrlaltkeys);
write_setting_i(sesskey, "TelnetKey", cfg->telnet_keyboard); write_setting_i(sesskey, "TelnetKey", cfg->telnet_keyboard);
write_setting_i(sesskey, "TelnetRet", cfg->telnet_newline);
write_setting_i(sesskey, "LocalEcho", cfg->localecho); write_setting_i(sesskey, "LocalEcho", cfg->localecho);
write_setting_i(sesskey, "LocalEdit", cfg->localedit); write_setting_i(sesskey, "LocalEdit", cfg->localedit);
write_setting_s(sesskey, "Answerback", cfg->answerback); write_setting_s(sesskey, "Answerback", cfg->answerback);
@ -388,6 +389,7 @@ void load_settings(char *section, int do_host, Config * cfg)
gppi(sesskey, "ComposeKey", 0, &cfg->compose_key); gppi(sesskey, "ComposeKey", 0, &cfg->compose_key);
gppi(sesskey, "CtrlAltKeys", 1, &cfg->ctrlaltkeys); gppi(sesskey, "CtrlAltKeys", 1, &cfg->ctrlaltkeys);
gppi(sesskey, "TelnetKey", 0, &cfg->telnet_keyboard); gppi(sesskey, "TelnetKey", 0, &cfg->telnet_keyboard);
gppi(sesskey, "TelnetRet", 1, &cfg->telnet_newline);
gppi(sesskey, "LocalEcho", LD_BACKEND, &cfg->localecho); gppi(sesskey, "LocalEcho", LD_BACKEND, &cfg->localecho);
gppi(sesskey, "LocalEdit", LD_BACKEND, &cfg->localedit); gppi(sesskey, "LocalEdit", LD_BACKEND, &cfg->localedit);
gpps(sesskey, "Answerback", "PuTTY", cfg->answerback, gpps(sesskey, "Answerback", "PuTTY", cfg->answerback,

View File

@ -437,6 +437,7 @@ enum { IDCX_ABOUT =
IDC_TPASSIVE, IDC_TPASSIVE,
IDC_TACTIVE, IDC_TACTIVE,
IDC_TELNETKEY, IDC_TELNETKEY,
IDC_TELNETRET,
telnetpanelend, telnetpanelend,
rloginpanelstart, rloginpanelstart,
@ -802,6 +803,7 @@ char *help_context_cmd(int id)
case IDC_TACTIVE: case IDC_TACTIVE:
return "JI(`',`telnet.passive')"; return "JI(`',`telnet.passive')";
case IDC_TELNETKEY: case IDC_TELNETKEY:
case IDC_TELNETRET:
return "JI(`',`telnet.specialkeys')"; return "JI(`',`telnet.specialkeys')";
case IDC_R_TSSTATIC: case IDC_R_TSSTATIC:
@ -969,6 +971,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
CheckDlgButton(hwnd, IDC_COMPOSEKEY, cfg.compose_key); CheckDlgButton(hwnd, IDC_COMPOSEKEY, cfg.compose_key);
CheckDlgButton(hwnd, IDC_CTRLALTKEYS, cfg.ctrlaltkeys); CheckDlgButton(hwnd, IDC_CTRLALTKEYS, cfg.ctrlaltkeys);
CheckDlgButton(hwnd, IDC_TELNETKEY, cfg.telnet_keyboard); CheckDlgButton(hwnd, IDC_TELNETKEY, cfg.telnet_keyboard);
CheckDlgButton(hwnd, IDC_TELNETRET, cfg.telnet_newline);
CheckRadioButton(hwnd, IDC_ECHOBACKEND, IDC_ECHONO, CheckRadioButton(hwnd, IDC_ECHOBACKEND, IDC_ECHONO,
cfg.localecho == LD_BACKEND ? IDC_ECHOBACKEND : cfg.localecho == LD_BACKEND ? IDC_ECHOBACKEND :
cfg.localecho == LD_YES ? IDC_ECHOYES : IDC_ECHONO); cfg.localecho == LD_YES ? IDC_ECHOYES : IDC_ECHONO);
@ -1580,6 +1583,8 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
beginbox(&cp, "Adjust telnet session.", IDC_BOX_CONNECTION1); beginbox(&cp, "Adjust telnet session.", IDC_BOX_CONNECTION1);
checkbox(&cp, "Keyboard sends telnet Backspace and Interrupt", checkbox(&cp, "Keyboard sends telnet Backspace and Interrupt",
IDC_TELNETKEY); IDC_TELNETKEY);
checkbox(&cp, "Return key sends telnet New Line instead of ^M",
IDC_TELNETRET);
endbox(&cp); endbox(&cp);
} }
beginbox(&cp, "Sending of null packets to keep session active", beginbox(&cp, "Sending of null packets to keep session active",
@ -1620,6 +1625,8 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
IDC_TACTIVE, NULL); IDC_TACTIVE, NULL);
checkbox(&cp, "&Keyboard sends telnet Backspace and Interrupt", checkbox(&cp, "&Keyboard sends telnet Backspace and Interrupt",
IDC_TELNETKEY); IDC_TELNETKEY);
checkbox(&cp, "Return key sends telnet New Line instead of ^M",
IDC_TELNETRET);
endbox(&cp); endbox(&cp);
} }
} }
@ -2333,6 +2340,12 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
cfg.telnet_keyboard = cfg.telnet_keyboard =
IsDlgButtonChecked(hwnd, IDC_TELNETKEY); IsDlgButtonChecked(hwnd, IDC_TELNETKEY);
break; break;
case IDC_TELNETRET:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.telnet_newline =
IsDlgButtonChecked(hwnd, IDC_TELNETRET);
break;
case IDC_WRAPMODE: case IDC_WRAPMODE:
if (HIWORD(wParam) == BN_CLICKED || if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED) HIWORD(wParam) == BN_DOUBLECLICKED)