mirror of https://gerrit.osmocom.org/libtelnet
remove AUTO_CRLF flag, realized it is conceptually broken
This commit is contained in:
parent
97a8cb25b9
commit
4a1240e2a7
8
README
8
README
|
@ -78,14 +78,6 @@ IIa. Initialization
|
|||
LIBTELNET_FLAG_PROXY
|
||||
Operate in proxy mode. This disables the RFC1143 support and
|
||||
enables automatic detection of COMPRESS2 streams.
|
||||
|
||||
LIBTELNET_FLAG_AUTO_CRLF
|
||||
Automatically translate C newlines (\n) into the TELNET
|
||||
newline marker, CRLF (\r\n). This also translates the C
|
||||
carriage return (\r) into the TELNET-correct CRNUL (\r\0).
|
||||
|
||||
Note that this only affects data that is sent. Received
|
||||
data is untranslated, even with this flag set.
|
||||
|
||||
boid libtelnet_free(libtelnet_t *telnet);
|
||||
Releases any internal memory allocated by libtelnet. This must
|
||||
|
|
16
libtelnet.c
16
libtelnet.c
|
@ -794,8 +794,6 @@ void libtelnet_send_negotiate(libtelnet_t *telnet, unsigned char cmd,
|
|||
/* send non-command data (escapes IAC bytes) */
|
||||
void libtelnet_send_data(libtelnet_t *telnet, const unsigned char *buffer,
|
||||
unsigned int size) {
|
||||
static const unsigned char CRLF[] = { '\r', '\n' };
|
||||
static const unsigned char CRNUL[] = { '\r', '\0' };
|
||||
unsigned int i, l;
|
||||
|
||||
for (l = i = 0; i != size; ++i) {
|
||||
|
@ -808,20 +806,6 @@ void libtelnet_send_data(libtelnet_t *telnet, const unsigned char *buffer,
|
|||
|
||||
/* send escape */
|
||||
libtelnet_send_command(telnet, LIBTELNET_IAC);
|
||||
|
||||
/* automatic translation of \n -> CRLF and \r -> CRNUL */
|
||||
} else if (telnet->flags & LIBTELNET_FLAG_AUTO_CRLF &&
|
||||
(buffer[i] == '\r' || buffer[i] == '\n')) {
|
||||
/* dump prior text if any */
|
||||
if (i != l)
|
||||
_send(telnet, buffer + l, i - l);
|
||||
l = i + 1;
|
||||
|
||||
/* translate */
|
||||
if (buffer[i] == '\r')
|
||||
_send(telnet, CRNUL, 2);
|
||||
else
|
||||
_send(telnet, CRLF, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,6 @@ typedef enum libtelnet_event_type_t libtelnet_event_type_t;
|
|||
|
||||
/* libtelnet feature flags */
|
||||
#define LIBTELNET_FLAG_PROXY (1<<0)
|
||||
#define LIBTELNET_FLAG_AUTO_CRLF (1<<1)
|
||||
|
||||
#define LIBTELNET_PFLAG_DEFLATE (1<<7)
|
||||
|
||||
|
|
Loading…
Reference in New Issue