Subversion Repositories Kolibri OS

Rev

Rev 3814 | Rev 4922 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3814 Rev 4920
Line 3... Line 3...
3
        push    str_help
3
        push    str_help
4
        call    [con_write_asciiz]
4
        call    [con_write_asciiz]
Line 5... Line 5...
5
 
5
 
Line -... Line 6...
-
 
6
        jmp     wait_for_usercommand
6
        jmp     wait_for_usercommand
7
 
Line -... Line 8...
-
 
8
 
-
 
9
cmd_bye:
7
 
10
 
8
cmd_bye:
11
; Send BYE message to the server
Line -... Line 12...
-
 
12
        mov     dword[s], "BYE" + 13 shl 24
-
 
13
        mov     byte[s+4], 10
9
 
14
        mcall   send, [socketnum], s, 5, 0
Line -... Line 15...
-
 
15
 
10
        mcall   close, [socketnum]
16
; Close the control connection
Line 11... Line 17...
11
        mcall   close, [datasocket]
17
        mcall   close, [socketnum]
12
 
18
        jmp     main
13
        jmp     main
19
 
Line 14... Line 20...
14
 
20
 
Line -... Line 21...
-
 
21
cmd_pwd:
15
cmd_pwd:
22
 
Line 16... Line 23...
16
 
23
        mov     dword[s], "PWD" + 13 shl 24
Line 17... Line 24...
17
        mov     dword[s], "PWD" + 13 shl 24
24
        mov     byte[s+4], 10
Line 33... Line 40...
33
 
40
 
Line 34... Line 41...
34
        mcall   send, [socketnum], s, , 0
41
        mcall   send, [socketnum], s, , 0
Line -... Line 42...
-
 
42
 
35
 
43
        jmp     wait_for_servercommand
Line 36... Line 44...
36
        jmp     wait_for_servercommand
44
 
37
 
45
 
Line 49... Line 57...
49
 
57
 
Line 50... Line 58...
50
        mcall   send, [socketnum], s, , 0
58
        mcall   send, [socketnum], s, , 0
Line 51... Line -...
51
 
-
 
Line -... Line 59...
-
 
59
 
52
        jmp     wait_for_servercommand
60
        jmp     wait_for_servercommand
Line 53... Line 61...
53
 
61
 
Line 54... Line 62...
54
cmd_list:
62
 
Line 63... Line 71...
63
 
71
 
Line 64... Line 72...
64
        jmp     wait_for_servercommand
72
        jmp     wait_for_servercommand
65
 
-
 
66
 
73
 
Line -... Line 74...
-
 
74
 
-
 
75
cmd_retr:
67
cmd_retr:
76
        call    open_dataconnection
-
 
77
        
-
 
78
; Create/open the file
Line 68... Line 79...
68
 
79
 
69
        call    open_dataconnection
80
        mov     esi, s+5
70
 
81
        mov     ecx, 256-5
71
        mov     [operation], OPERATION_RETR
82
        call    set_filename
72
 
83
 
Line 73... Line -...
73
        mov     [filestruct.subfn], 2   ; create/rewrite file
-
 
74
        mov     [filestruct.offset], 0
-
 
75
        mov     [filestruct.offset+4], 0
-
 
76
        mov     [filestruct.size], 0
-
 
77
        mov     [filestruct.ptr], 0
-
 
78
 
84
        mov     [filestruct.subfn], 2   ; create/rewrite file
79
        lea     esi, [s+5]
85
        mov     [filestruct.offset], 0
80
        mov     edi, filestruct.name
86
        mov     [filestruct.offset+4], 0
Line -... Line 87...
-
 
87
        mov     [filestruct.size], 0
-
 
88
        mov     [filestruct.ptr], 0
81
        mov     ecx, 256-5
89
 
-
 
90
        mcall   70, filestruct
-
 
91
        cmp     eax, -1
-
 
92
;        je      fileerror
Line 82... Line 93...
82
        call    set_filename
93
 
83
 
94
; Prepare to write to the file
Line 84... Line 95...
84
        mcall   70, filestruct
95
 
85
        cmp     eax, -1
96
        mov     [filestruct.subfn], 3   ; write to file
86
;        je      fileerror
97
        mov     [operation], OPERATION_RETR
87
 
98
 
88
        mov     [filestruct.subfn], 3   ; write to file
99
; Request the file from server
89
 
100
 
90
        mov     dword[s], "RETR"
101
        mov     dword[s], "RETR"
Line -... Line 102...
-
 
102
        mov     byte[s+4], " "
91
        mov     byte[s+4], " "
103
 
Line 92... Line 104...
92
 
104
        mov     ecx, 256
Line 111... Line 123...
111
        mov     [filestruct.offset], 0
123
        mov     [filestruct.offset], 0
112
        mov     [filestruct.offset+4], 0
124
        mov     [filestruct.offset+4], 0
113
        mov     [filestruct.size], BUFFERSIZE
125
        mov     [filestruct.size], BUFFERSIZE
114
        mov     [filestruct.ptr], buffer_ptr2
126
        mov     [filestruct.ptr], buffer_ptr2
Line 115... Line 127...
115
 
127
 
116
        lea     esi, [s+5]
-
 
117
        mov     edi, filestruct.name
128
        mov     esi, s+5
118
        mov     ecx, 256-5
129
        mov     ecx, 256-5
Line 119... Line 130...
119
        call    set_filename
130
        call    set_filename
120
 
131
 
Line 152... Line 163...
152
        invoke  con_write_asciiz, s
163
        invoke  con_write_asciiz, s
153
        invoke  con_write_asciiz, str_newline
164
        invoke  con_write_asciiz, str_newline
Line 154... Line 165...
154
 
165
 
Line -... Line 166...
-
 
166
        jmp     wait_for_usercommand
155
        jmp     wait_for_usercommand
167
 
Line 156... Line 168...
156
 
168
 
157
cmd_cdup:
169
cmd_cdup:
158
 
170
 
Line 159... Line 171...
159
        mov     dword[s], "CDUP"
171
        mov     dword[s], "CDUP"
Line -... Line 172...
-
 
172
        mov     word[s+4], 0x0d0a
160
        mov     word[s+4], 0x0d0a
173
        mcall   send, [socketnum], s, 6, 0
Line 161... Line 174...
161
        mcall   send, [socketnum], s, 6, 0
174
 
Line 162... Line 175...
162
 
175
        jmp     wait_for_servercommand
Line 175... Line 188...
175
 
188
 
Line 176... Line 189...
176
        mcall   send, [socketnum], s, , 0
189
        mcall   send, [socketnum], s, , 0
Line -... Line 190...
-
 
190
 
177
 
191
        jmp     wait_for_servercommand
Line 178... Line 192...
178
        jmp     wait_for_servercommand
192
 
Line 179... Line 193...
179
 
193
 
Line 191... Line 205...
191
        mcall   send, [socketnum], s, , 0
205
        mcall   send, [socketnum], s, , 0
Line 192... Line 206...
192
 
206
 
Line 193... Line -...
193
        jmp     wait_for_servercommand
-
 
194
 
207
        jmp     wait_for_servercommand
195
 
-
 
196
 
208
 
197
; esi   = source ptr
209
 
Line -... Line 210...
-
 
210
; esi   = source ptr
198
; edi   = dest ptr
211
; ecx   = max length of source buffer
199
; ecx   = max length of source buffer
212
set_filename:
200
set_filename:
213
 
201
 
214
        mov     edi, filestruct.name
202
  .loop:
-
 
203
        lodsb
-
 
204
        test    al, al
215
  .loop:
205
        jz      .done
216
        lodsb
206
        cmp     al, ' '
217
        test    al, al
207
        je      .done
218
        jz      .done
208
        cmp     al, 10
219
        cmp     al, 10
209
        je      .done
220
        je      .done
210
        stosb
221
        stosb
Line 211... Line 222...
211
        loop    .loop
222
        loop    .loop
212
  .done:
-