Subversion Repositories Kolibri OS

Rev

Rev 3800 | Rev 3804 | 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
 
152
 
153
 
3800 hidnplayr 154
; esi   = source ptr
155
; edi   = dest ptr
156
; ecx   = max length of source buffer
157
set_filename:
158
 
159
  .loop:
160
        lodsb
161
        test    al, al
162
        jz      .done
163
        cmp     al, ' '
164
        je      .done
165
        cmp     al, 10
166
        je      .done
167
        stosb
168
        loop    .loop
169
  .done:
170
        xor     al, al          ; append a 0 byte
171
        stosb
172
 
173
        ret
174