Rev 5011 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5011 | Rev 6582 | ||
---|---|---|---|
Line 13... | Line 13... | ||
13 | mov byte[buf_cmd+4], 10 |
13 | mov byte[buf_cmd+4], 10 |
14 | mcall send, [controlsocket], buf_cmd, 5, 0 |
14 | mcall send, [controlsocket], buf_cmd, 5, 0 |
Line 15... | Line 15... | ||
15 | 15 | ||
16 | ; Close the control connection |
16 | ; Close the control connection |
17 | mcall close, [controlsocket] |
17 | mcall close, [controlsocket] |
Line 18... | Line 18... | ||
18 | jmp main |
18 | ijmp eax, interface_addr, interface.server_addr |
Line 19... | Line 19... | ||
19 | 19 | ||
Line 44... | Line 44... | ||
44 | 44 | ||
Line 45... | Line 45... | ||
45 | 45 | ||
46 | cmd_dele: |
46 | cmd_dele: |
Line 47... | Line 47... | ||
47 | 47 | ||
48 | mov dword[buf_cmd], "DELE" |
48 | mov dword[buf_cmd], "DELE" |
49 | mov byte[buf_cmd], " " |
49 | mov byte[buf_cmd+4], " " |
50 | 50 | ||
Line 74... | Line 74... | ||
74 | 74 | ||
75 | cmd_retr: |
75 | cmd_retr: |
Line 76... | Line 76... | ||
76 | call open_dataconnection |
76 | call open_dataconnection |
77 | - | ||
78 | ; Create/open the file |
77 | |
Line 79... | Line 78... | ||
79 | 78 | ; Create/open the file |
|
80 | ; Create/open the file |
79 | ; TODO: check beforehand if the disk has enough free space available to store the file |
81 | 80 | ||
Line 88... | Line 87... | ||
88 | mov [filestruct.offset+4], 0 |
87 | mov [filestruct.offset+4], 0 |
89 | mov [filestruct.size], 0 |
88 | mov [filestruct.size], 0 |
90 | mov [filestruct.ptr], 0 |
89 | mov [filestruct.ptr], 0 |
Line 91... | Line 90... | ||
91 | 90 | ||
92 | mcall 70, filestruct |
91 | mcall 70, filestruct |
- | 92 | test eax, eax |
|
93 | cmp eax, -1 |
93 | jz @f |
- | 94 | call error_fs |
|
94 | ; je fileerror |
95 | jmp close_datacon |
95 | 96 | @@: |
|
Line 96... | Line 97... | ||
96 | ; Prepare to write to the file |
97 | ; Prepare to write to the file |
97 | 98 | ||
Line 109... | Line 110... | ||
109 | repne scasb |
110 | repne scasb |
110 | lea esi, [edi - buf_cmd] |
111 | lea esi, [edi - buf_cmd] |
111 | mov dword[edi - 2], 0x0a0d |
112 | mov dword[edi - 2], 0x0a0d |
112 | mcall send, [controlsocket], buf_cmd, , 0 |
113 | mcall send, [controlsocket], buf_cmd, , 0 |
Line 113... | Line 114... | ||
113 | 114 | ||
114 | invoke con_write_asciiz, buf_cmd ; print command |
115 | icall eax, interface_addr, interface.print, buf_cmd |
Line 115... | Line 116... | ||
115 | jmp wait_for_servercommand |
116 | jmp wait_for_servercommand |
Line 116... | Line 117... | ||
116 | 117 | ||
Line 134... | Line 135... | ||
134 | 135 | ||
Line 135... | Line 136... | ||
135 | call open_dataconnection |
136 | call open_dataconnection |
Line -... | Line 137... | ||
- | 137 | ||
136 | 138 | mov [operation], OPERATION_STOR |
|
137 | mov [operation], OPERATION_STOR |
139 | |
138 | 140 | ; get file size |
|
139 | mov [filestruct.subfn], 0 ; read file |
141 | mov [filestruct.subfn], 5 |
140 | mov [filestruct.offset], 0 |
142 | mov [filestruct.offset], 0 |
Line 141... | Line 143... | ||
141 | mov [filestruct.offset+4], 0 |
143 | mov [filestruct.offset+4], 0 |
142 | mov [filestruct.size], BUFFERSIZE |
144 | mov [filestruct.size], 0 |
143 | mov [filestruct.ptr], buf_buffer2 |
145 | mov [filestruct.ptr], folder_buf |
Line -... | Line 146... | ||
- | 146 | ||
- | 147 | mov esi, buf_cmd+5 |
|
- | 148 | mov ecx, 256-5 |
|
- | 149 | call set_filename |
|
- | 150 | ||
- | 151 | mcall 70, filestruct |
|
- | 152 | ||
- | 153 | mov eax, dword[folder_buf+32] ; supports file size upto 4GB |
|
- | 154 | mov [file_size], eax |
|
- | 155 | ||
- | 156 | mov [filestruct.subfn], 0 ; read file |
|
144 | 157 | ; mov [filestruct.offset], 0 |
|
145 | mov esi, buf_cmd+5 |
158 | ; mov [filestruct.offset+4], 0 |
Line 146... | Line 159... | ||
146 | mov ecx, 256-5 |
159 | mov [filestruct.size], BUFFERSIZE |
147 | call set_filename |
160 | mov [filestruct.ptr], buf_buffer2 |
Line 167... | Line 180... | ||
167 | je .print |
180 | je .print |
168 | mov ecx, 256-5 |
181 | mov ecx, 256-5 |
169 | .loop: |
182 | .loop: |
170 | lodsb |
183 | lodsb |
171 | cmp al, 10 |
184 | cmp al, 10 |
172 | je .done |
185 | je .check |
173 | test al, al |
186 | test al, al |
174 | je .done |
187 | je .check |
175 | loop .loop |
188 | loop .loop |
- | 189 | ||
176 | .done: |
190 | .check: |
177 | mov byte[esi-1], 0 |
191 | mov byte[esi-1], 0 |
- | 192 | ||
- | 193 | ; check whether entered path is valid (folder exists) |
|
- | 194 | mov [filestruct2.subfn], 5 |
|
- | 195 | mov [filestruct2.offset], 0 |
|
- | 196 | mov [filestruct2.size], 0 |
|
- | 197 | mov [filestruct2.ptr], folder_buf |
|
- | 198 | mov [filestruct2.name], buf_cmd+5 |
|
- | 199 | mcall 70, filestruct2 |
|
- | 200 | test eax, eax |
|
- | 201 | jz @f |
|
- | 202 | cmp eax, 2 |
|
- | 203 | je @f |
|
- | 204 | call error_fs |
|
- | 205 | jmp wait_for_usercommand |
|
- | 206 | ||
- | 207 | @@: |
|
178 | mcall 30, 1, buf_cmd+5 ; set working directory |
208 | mcall 30, 1, buf_cmd+5 ; set working directory |
- | 209 | ||
179 | .print: |
210 | .print: |
180 | mcall 30, 2, buf_cmd, 256 ; and read it again |
211 | mcall 30, 2, buf_cmd, 256 ; and read it again |
181 | - | ||
182 | invoke con_write_asciiz, str_lcwd |
- | |
183 | invoke con_write_asciiz, buf_cmd |
- | |
184 | invoke con_write_asciiz, str_newline |
212 | icall eax, interface_addr, interface.print, str_lcwd, buf_cmd, str_newline |
Line 185... | Line 213... | ||
185 | 213 | ||
Line 186... | Line 214... | ||
186 | jmp wait_for_usercommand |
214 | jmp wait_for_usercommand |
Line 187... | Line 215... | ||
187 | 215 | ||
188 | 216 | ||
189 | cmd_cdup: |
217 | cmd_cdup: |
Line 190... | Line 218... | ||
190 | 218 | ||
Line 225... | Line 253... | ||
225 | mcall send, [controlsocket], buf_cmd, , 0 |
253 | mcall send, [controlsocket], buf_cmd, , 0 |
Line 226... | Line 254... | ||
226 | 254 | ||
Line -... | Line 255... | ||
- | 255 | jmp wait_for_servercommand |
|
- | 256 | ||
- | 257 | ||
- | 258 | cmd_abor: |
|
- | 259 | ||
- | 260 | mcall close, [datasocket] |
|
227 | jmp wait_for_servercommand |
261 | jmp wait_for_servercommand |
228 | 262 | ||
229 | 263 | ||
Line 230... | Line 264... | ||
230 | ; esi = source ptr |
264 | ; esi = source ptr |