Skip to content
Snippets Groups Projects
Commit ff69ea35 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Telnet commands haven't been sent to node-spy ring buffers for years now

... so no need to parse/strip them here.
parent af28a1e1
No related branches found
No related tags found
No related merge requests found
Pipeline #5942 passed
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "MainFormUnit.h" #include "MainFormUnit.h"
#include "SpyFormUnit.h" #include "SpyFormUnit.h"
#include "telnet.h"
#include "str_util.h" #include "str_util.h"
#define SPYBUF_LEN 100000 #define SPYBUF_LEN 100000
...@@ -54,7 +53,7 @@ __fastcall TSpyForm::~TSpyForm() ...@@ -54,7 +53,7 @@ __fastcall TSpyForm::~TSpyForm()
delete Terminal; delete Terminal;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int __fastcall TSpyForm::strip_telnet(uchar *buf, int len) int __fastcall TSpyForm::ParseOutput(uchar *buf, int len)
{ {
int i; int i;
int telnet_cmd=0; int telnet_cmd=0;
...@@ -65,22 +64,6 @@ int __fastcall TSpyForm::strip_telnet(uchar *buf, int len) ...@@ -65,22 +64,6 @@ int __fastcall TSpyForm::strip_telnet(uchar *buf, int len)
Terminal->Clear(); Terminal->Clear();
continue; continue;
} }
if(buf[i]==TELNET_IAC || telnet_cmd) {
if(telnet_cmd==1 && buf[i]==TELNET_IAC) {
telnet_cmd=0; /* escape IAC */
continue;
}
if(telnet_cmd==1 && buf[i]<TELNET_WILL) {
telnet_cmd=0; /* single byte command */
continue;
}
if(telnet_cmd>=2) {
telnet_cmd=0; /* two byte command */
continue;
}
telnet_cmd++;
continue;
}
buf[newlen++]=buf[i]; buf[newlen++]=buf[i];
} }
return(newlen); return(newlen);
...@@ -100,7 +83,7 @@ void __fastcall TSpyForm::SpyTimerTick(TObject *Sender) ...@@ -100,7 +83,7 @@ void __fastcall TSpyForm::SpyTimerTick(TObject *Sender)
if(fdate(TerminalIniFile.c_str()) > terminal_fdate) if(fdate(TerminalIniFile.c_str()) > terminal_fdate)
ReadTerminalIniFile(); ReadTerminalIniFile();
} }
rd=strip_telnet(buf,rd); rd=ParseOutput(buf,rd);
buf[rd] = 0; buf[rd] = 0;
if(utf8) if(utf8)
utf8_to_cp437_inplace(buf); utf8_to_cp437_inplace(buf);
......
...@@ -60,7 +60,7 @@ __published: // IDE-managed Components ...@@ -60,7 +60,7 @@ __published: // IDE-managed Components
void __fastcall FormMouseUp(TObject *Sender, TMouseButton Button, void __fastcall FormMouseUp(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y); TShiftState Shift, int X, int Y);
private: // User declarations private: // User declarations
int __fastcall strip_telnet(uchar *buf, int len); int __fastcall ParseOutput(uchar *buf, int len);
time_t terminal_fdate; time_t terminal_fdate;
void __fastcall ReadTerminalIniFile(); void __fastcall ReadTerminalIniFile();
bool utf8; bool utf8;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment