Subversion Repositories Kolibri OS

Rev

Rev 3802 | Rev 3813 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3701 hidnplayr 1
cmd_help:
2
 
3
        push    str_help
4
        call    [con_write_asciiz]
5
 
3790 hidnplayr 6
        jmp     wait_for_usercommand
7
 
3800 hidnplayr 8
cmd_bye:
9
 
10
        mcall   close, [socketnum]
11
        mcall   close, [datasocket]
12
 
13
        jmp     main
14
 
3794 hidnplayr 15
cmd_pwd:
16
 
17
        mov     dword[s], "PWD" + 10 shl 24
18
        mcall   send, [socketnum], s, 4, 0
19
 
20
        jmp     wait_for_servercommand
21
 
3790 hidnplayr 22
cmd_cwd:
23
 
24
        mov     dword[s], "CWD "
25
 
26
        mov     ecx, 256
27
        xor     al, al
28
        mov     edi, s
29
        repne scasb
30
        lea     esi, [edi - s - 1]
31
 
32
        mcall   send, [socketnum], s, , 0
33
 
3793 hidnplayr 34
        jmp     wait_for_servercommand
35
 
3800 hidnplayr 36
cmd_dele:
3793 hidnplayr 37
 
3800 hidnplayr 38
        mov     dword[s], "DELE"
39
        mov     byte[s], " "
40
 
41
        mov     ecx, 256
42
        xor     al, al
43
        mov     edi, s
44
        repne scasb
45
        lea     esi, [edi - s - 1]
46
 
47
        mcall   send, [socketnum], s, , 0
48
 
49
        jmp     wait_for_servercommand
50
 
51
cmd_list:
52
 
53
        call    open_dataconnection
54
 
55
        mov     [operation], OPERATION_LIST
56
 
57
        mov     dword[s], "LIST"
58
        mov     byte[s+4], 0x0a
59
        mcall   send, [socketnum], s, 5, 0
60
 
61
        jmp     wait_for_servercommand
62
 
63
 
3793 hidnplayr 64
cmd_retr:
65
 
66
        call    open_dataconnection
67
 
3800 hidnplayr 68
        mov     [operation], OPERATION_RETR
69
 
70
        mov     [filestruct.subfn], 2   ; create/rewrite file
71
        mov     [filestruct.offset], 0
72
        mov     [filestruct.offset+4], 0
73
        mov     [filestruct.size], 0
74
        mov     [filestruct.ptr], 0
75
 
76
        lea     esi, [s+5]
77
        mov     edi, filestruct.name
78
        mov     ecx, 256-5
79
        call    set_filename
80
 
81
        mcall   70, filestruct
82
        cmp     eax, -1
83
;        je      fileerror
84
 
85
        mov     [filestruct.subfn], 3   ; write to file
86
 
3793 hidnplayr 87
        mov     dword[s], "RETR"
88
        mov     byte[s+4], " "
89
 
90
        mov     ecx, 256
91
        xor     al, al
92
        mov     edi, s
93
        repne scasb
94
        lea     esi, [edi - s - 1]
95
        mcall   send, [socketnum], s, , 0
96
 
97
        jmp     wait_for_servercommand
98
 
99
 
100
cmd_stor:
101
 
102
        call    open_dataconnection
103
 
3800 hidnplayr 104
        mov     [operation], OPERATION_STOR
105
 
106
        mov     [filestruct.subfn], 0   ; read file
107
        mov     [filestruct.offset], 0
108
        mov     [filestruct.offset+4], 0
109
        mov     [filestruct.size], BUFFERSIZE
110
        mov     [filestruct.ptr], buffer_ptr2
111
 
112
        lea     esi, [s+5]
113
        mov     edi, filestruct.name
114
        mov     ecx, 256-5
115
        call    set_filename
116
 
3793 hidnplayr 117
        mov     dword[s], "STOR"
118
        mov     byte[s+4], " "
119
 
120
        mov     ecx, 256
121
        xor     al, al
122
        mov     edi, s
123
        repne scasb
124
        lea     esi, [edi - s - 1]
125
        mcall   send, [socketnum], s, , 0
126
 
3800 hidnplayr 127
        jmp     wait_for_servercommand
128
 
129
 
3802 hidnplayr 130
cmd_lcwd:
3800 hidnplayr 131
 
3802 hidnplayr 132
        mov     esi, s+5
133
        mov     ecx, 256-5
134
  .loop:
135
        lodsb
136
        cmp     al, 10
137
        je      .done
138
        test    al, al
139
        je      .done
140
        loop    .loop
141
  .done:
142
        mov     byte[esi-1], 0
143
        mcall   30, 1, s+5              ; set working directory
144
        mcall   30, 2, s, 256           ; and read it again
145
 
146
        invoke  con_write_asciiz, str_lcwd
147
        invoke  con_write_asciiz, s
148
        invoke  con_write_asciiz, str4  ; newline
149
 
150
        jmp     wait_for_usercommand
151
 
3804 hidnplayr 152
cmd_cdup:
3802 hidnplayr 153
 
3804 hidnplayr 154
        mov     dword[s], "CDUP"
155
        mov     byte[s+4], 0x0a
156
        mcall   send, [socketnum], s, 5, 0
3802 hidnplayr 157
 
3804 hidnplayr 158
        jmp     wait_for_servercommand
159
 
160
cmd_rmd:
161
 
162
        mov     dword[s], "RMD "
163
 
164
        mov     ecx, 256
165
        xor     al, al
166
        mov     edi, s
167
        repne scasb
168
        lea     esi, [edi - s - 1]
169
 
170
        mcall   send, [socketnum], s, , 0
171
 
172
        jmp     wait_for_servercommand
173
 
174
cmd_mkd:
175
 
176
        mov     dword[s], "MKD "
177
 
178
        mov     ecx, 256
179
        xor     al, al
180
        mov     edi, s
181
        repne scasb
182
        lea     esi, [edi - s - 1]
183
 
184
        mcall   send, [socketnum], s, , 0
185
 
186
        jmp     wait_for_servercommand
187
 
188
 
189
 
3800 hidnplayr 190
; esi   = source ptr
191
; edi   = dest ptr
192
; ecx   = max length of source buffer
193
set_filename:
194
 
195
  .loop:
196
        lodsb
197
        test    al, al
198
        jz      .done
199
        cmp     al, ' '
200
        je      .done
201
        cmp     al, 10
202
        je      .done
203
        stosb
204
        loop    .loop
205
  .done:
206
        xor     al, al          ; append a 0 byte
207
        stosb
208
 
209
        ret
210