FTPc: added lcwd command (change local working directory)

git-svn-id: svn://kolibrios.org@3802 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2013-07-10 10:17:07 +00:00
parent d99c6f5983
commit c32d5d4bbb
2 changed files with 28 additions and 0 deletions

View File

@ -222,6 +222,9 @@ wait_for_usercommand:
cmp dword[s], "bye" + 10 shl 24 cmp dword[s], "bye" + 10 shl 24
je cmd_bye je cmd_bye
cmp dword[s], "lcwd"
je cmd_lcwd
invoke con_write_asciiz, str_unknown invoke con_write_asciiz, str_unknown
jmp wait_for_usercommand jmp wait_for_usercommand
@ -311,6 +314,7 @@ str12 db 'Waiting for welcome message.',10,0
str_user db "username: ",0 str_user db "username: ",0
str_pass db "password: ",0 str_pass db "password: ",0
str_unknown db "unknown command",10,0 str_unknown db "unknown command",10,0
str_lcwd db "local working directory is now: ",0
str_help db "available commands:",10 str_help db "available commands:",10
db "help - help",10,10 db "help - help",10,10
@ -318,6 +322,7 @@ str_help db "available commands:",10
db "cwd - change working directoy on server",10 db "cwd - change working directoy on server",10
db "dele - delete file from server",10 db "dele - delete file from server",10
db "list - list files and folders in current directory",10 db "list - list files and folders in current directory",10
db "lcwd - change local working directory",10
db "pwd - print working directory",10 db "pwd - print working directory",10
db "retr - retreive file from server",10 db "retr - retreive file from server",10
db "stor - store file on server",10 db "stor - store file on server",10

View File

@ -127,6 +127,29 @@ cmd_stor:
jmp wait_for_servercommand jmp wait_for_servercommand
cmd_lcwd:
mov esi, s+5
mov ecx, 256-5
.loop:
lodsb
cmp al, 10
je .done
test al, al
je .done
loop .loop
.done:
mov byte[esi-1], 0
mcall 30, 1, s+5 ; set working directory
mcall 30, 2, s, 256 ; and read it again
invoke con_write_asciiz, str_lcwd
invoke con_write_asciiz, s
invoke con_write_asciiz, str4 ; newline
jmp wait_for_usercommand
; esi = source ptr ; esi = source ptr
; edi = dest ptr ; edi = dest ptr