Telnet: let console handle escape characters.

git-svn-id: svn://kolibrios.org@3687 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2013-06-19 14:14:38 +00:00
parent 07d3467c12
commit bc2140fbde

View File

@ -125,7 +125,7 @@ resolve:
pop esi pop esi
; test for error ; test for error
test eax, eax test eax, eax
jnz fail jnz dns_error
call [con_cls] call [con_cls]
push str3 push str3
@ -156,7 +156,7 @@ resolve:
mcall socket, AF_INET4, SOCK_STREAM, 0 mcall socket, AF_INET4, SOCK_STREAM, 0
cmp eax, -1 cmp eax, -1
jz fail2 jz socket_err
mov [socketnum], eax mov [socketnum], eax
mcall connect, [socketnum], sockaddr1, 18 mcall connect, [socketnum], sockaddr1, 18
@ -199,7 +199,7 @@ mainloop:
.no_cmd: .no_cmd:
cmp esi, buffer_ptr cmp esi, buffer_ptr
je .print_loop je .print
DEBUGF 1, 'TELNET: sending data\n' DEBUGF 1, 'TELNET: sending data\n'
@ -208,47 +208,29 @@ mainloop:
mcall send, [socketnum], buffer_ptr, , 0 mcall send, [socketnum], buffer_ptr, , 0
pop edi esi pop edi esi
.print_loop: .print:
DEBUGF 1, 'TELNET: printloop\n'
cmp esi, edi cmp esi, edi
jae mainloop jae mainloop
cmp byte [esi], 0x1b ; escape character push esi
jne .print_byte call [con_write_asciiz]
inc esi
cmp word [esi], 0x485b ; move cursor to beginning .loop:
jne @f lodsb
inc esi test al, al
inc esi jz .print
jmp .loop
DEBUGF 1, 'TELNET: resetting cursor \n'
push 0
push 0
call [con_set_cursor_pos]
jmp .print_loop
@@:
inc esi
inc esi
jmp .print_loop
.print_byte:
push dword 1
push esi ; next string to print
inc esi
call [con_write_string]
jmp .print_loop
fail2: socket_err:
DEBUGF 1, "TELNET: socket error %d", ebx
push str6 push str6
call [con_write_asciiz] call [con_write_asciiz]
jmp prompt jmp prompt
fail: dns_error:
DEBUGF 1, "TELNET: DNS error %d", eax
push str5 push str5
call [con_write_asciiz] call [con_write_asciiz]