mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 06:45:43 +02:00
Bug 477702 - Telnet line ending needs to be CRLF
This commit is contained in:
parent
02cf48046f
commit
194f4e2611
2 changed files with 25 additions and 11 deletions
|
@ -20,6 +20,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.terminal.connector.telnet.connector;
|
package org.eclipse.tm.terminal.connector.telnet.connector;
|
||||||
|
|
||||||
|
import java.io.FilterOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
@ -110,7 +111,29 @@ public class TelnetConnector extends TerminalConnectorImpl {
|
||||||
fInputStream = inputStream;
|
fInputStream = inputStream;
|
||||||
}
|
}
|
||||||
private void setOutputStream(OutputStream outputStream) {
|
private void setOutputStream(OutputStream outputStream) {
|
||||||
fOutputStream = outputStream;
|
if (outputStream == null) {
|
||||||
|
fOutputStream = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// send LF after CR (telnet end-of-line sequence - RFC 854)
|
||||||
|
fOutputStream = new FilterOutputStream(outputStream) {
|
||||||
|
final byte CR = 13;
|
||||||
|
final byte LF = 10;
|
||||||
|
final byte[] CRLF = { CR, LF };
|
||||||
|
int last = -1;
|
||||||
|
@Override
|
||||||
|
public void write(int b) throws IOException {
|
||||||
|
if (b == LF && last == CR) {
|
||||||
|
last = b;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
last = b;
|
||||||
|
if (b == CR)
|
||||||
|
out.write(CRLF);
|
||||||
|
else
|
||||||
|
out.write(b);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
Socket getSocket() {
|
Socket getSocket() {
|
||||||
return fSocket;
|
return fSocket;
|
||||||
|
|
|
@ -562,6 +562,7 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendString(String string) {
|
protected void sendString(String string) {
|
||||||
|
Logger.log(string);
|
||||||
try {
|
try {
|
||||||
// Send the string after converting it to an array of bytes using the
|
// Send the string after converting it to an array of bytes using the
|
||||||
// platform's default character encoding.
|
// platform's default character encoding.
|
||||||
|
@ -1182,16 +1183,6 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
|
||||||
//handling unnecessary further up.
|
//handling unnecessary further up.
|
||||||
sendChar(character, altKeyPressed);
|
sendChar(character, altKeyPressed);
|
||||||
|
|
||||||
// Special case: When we are in a TCP connection and echoing characters
|
|
||||||
// locally, send a LF after sending a CR.
|
|
||||||
// ISSUE: Is this absolutely required?
|
|
||||||
|
|
||||||
if (character == '\r' && getTerminalConnector() != null
|
|
||||||
&& isConnected()
|
|
||||||
&& getTerminalConnector().isLocalEcho()) {
|
|
||||||
sendChar('\n', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now decide if we should locally echo the character we just sent. We do
|
// Now decide if we should locally echo the character we just sent. We do
|
||||||
// _not_ locally echo the character if any of these conditions are true:
|
// _not_ locally echo the character if any of these conditions are true:
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Reference in a new issue