Pārlūkot izejas kodu

* fixes some telnet issues with TS_GA (go ahead) command

git-svn-id: trunk@5293 -
Almindor 19 gadi atpakaļ
vecāks
revīzija
80d964067a

+ 2 - 1
fcl/lnet/examples/ltelnet/ltclient.pp

@@ -95,7 +95,8 @@ begin
                  SendStr:='';
                end else begin
                  SendStr:=SendStr + c;
-                 Write(c);
+                 if not FCon.OptionIsSet(TS_ECHO) then
+                   Write(c);
                end;
         end;
       end;

+ 7 - 8
fcl/lnet/lcontrolstack.pp

@@ -45,7 +45,7 @@ type
     constructor Create;
     procedure Clear;
     procedure Push(const Value: Char);
-    property Index: Byte read FIndex;
+    property ItemIndex: Byte read FIndex;
     property Items[i: Byte]: Char read GetItem write SetItem; default;
     property Full: Boolean read GetFull;
     property OnFull: TLOnFull read FOnFull write FOnFull;
@@ -90,13 +90,12 @@ end;
 
 procedure TLControlStack.Push(const Value: Char);
 begin
-  if FIndex < TL_CSLENGTH then
-    begin
-      FItems[FIndex]:=Value;
-      Inc(FIndex);
-      if Full then
-        if Assigned(FOnFull) then FOnFull;
-    end;
+  if FIndex < TL_CSLENGTH then begin
+    FItems[FIndex]:=Value;
+    Inc(FIndex);
+    if Full and Assigned(FOnFull) then
+      FOnFull;
+  end;
 end;
 
 end.

+ 7 - 4
fcl/lnet/ltelnet.pp

@@ -245,11 +245,14 @@ procedure TLTelnet.TelnetParse(const msg: string);
 var
   i: Longint;
 begin
-  if Length(msg) > 0 then
-    for i:=1 to Length(msg) do
-      if (FStack.Index > 0) or (msg[i] = TS_IAC) then
+  for i:=1 to Length(msg) do
+    if (FStack.ItemIndex > 0) or (msg[i] = TS_IAC) then begin
+      if msg[i] = TS_GA then
+        FStack.Clear
+      else
         FStack.Push(msg[i])
-      else FOutput.WriteByte(Byte(msg[i]));
+    end else
+      FOutput.WriteByte(Byte(msg[i]));
 end;
 
 function TLTelnet.OptionIsSet(const Option: Char): Boolean;