Subversion Repositories Kolibri OS

Rev

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

Rev 2578 Rev 2581
Line 146... Line 146...
146
        loop    .find_zero
146
        loop    .find_zero
147
  .found_zero:
147
  .found_zero:
148
        pop     ecx
148
        pop     ecx
149
 
149
  .scan2:
150
        cmp     byte [esi], '/'
150
 
-
 
151
        cmp     byte [esi], '/'
Line 151... Line 152...
151
        jne     @f
152
        jne     @f
152
        inc     esi
153
        inc     esi
153
        dec     ecx
154
        dec     ecx
154
        jz      .done
155
        jz      .done
Line 180... Line 181...
180
        cmp     al, '.'
181
        cmp     al, '.'
181
        jne     .continue
182
        jne     .continue
182
 
183
 
183
;;;;        call    cmdCDUP     ;;;;;; FIXME
184
;;;;        TODO: find second last '\' in work_dir and make next char zero
Line -... Line 185...
-
 
185
;;;;        point edi to that 0
184
        jmp     .scan
186
 
-
 
187
        jmp     .scan2
185
 
188
 
Line 186... Line 189...
186
  .err:
189
  .err:
187
        ; TODO: print correct error message (550?)
190
        ; TODO: print correct error message (550?)
Line 188... Line 191...
188
 
191
 
Line 206... Line 209...
206
        mov     edx, [esp+4]                                    ; thread_data pointer
209
        mov     edx, [esp+4]                                    ; thread_data pointer
207
        cmp     eax, -1
210
        cmp     eax, -1
208
        je      socketerror
211
        je      socketerror
209
        mov     [edx + thread_data.datasocketnum], eax
212
  @@:
210
  @@:
213
 
211
 
-
 
212
; Create fpath from home_dir and work_dir
214
; Create fpath from home_dir and work_dir
Line 213... Line 215...
213
        call    create_path
215
        call    create_path
214
 
216
 
Line 230... Line 232...
230
 
232
 
231
        lea     edi, [edx + thread_data.buffer]
233
        lea     edi, [edx + thread_data.buffer]
Line 232... Line 234...
232
  .parse_file:
234
  .parse_file:
233
        test    eax, eax        ; did we find a file?
235
 
-
 
236
        test    eax, eax        ; did we find a file?
234
        jz      .done
237
        jz      .done
235
        mov     ebx, eax        ; yes, save the descripter in ebx
238
        mov     ebx, eax        ; yes, save the descripter in ebx
236
 
239
 
Line 237... Line 240...
237
; first, convert the attributes
240
; first, convert the attributes
Line 400... Line 403...
400
 
403
 
401
        mov     ecx, eax ;[edx + thread_data.passivesocknum]
404
        mov     ecx, eax ;[edx + thread_data.passivesocknum]
Line 402... Line 405...
402
        lea     edx, [edx + thread_data.datasock]
405
        lea     edx, [edx + thread_data.datasock]
403
        mcall   bind, , , sizeof.thread_data.datasock
406
        mov     esi, sizeof.thread_data.datasock
404
        mov     edx, [esp+4]                                    ; thread_data pointer
407
        mcall   bind
-
 
408
        mov     edx, [esp+4]                                    ; thread_data pointer
405
        cmp     eax, -1
409
        cmp     eax, -1
406
        je      bind_err
410
        je      bind_err
407
 
411
 
Line 408... Line 412...
408
; And set it to listen!
412
; And set it to listen!
Line 437... Line 441...
437
        sub     esi, edx
441
        sub     esi, edx
438
        mov     ecx, [edx + thread_data.socketnum]
442
        mov     ecx, [edx + thread_data.socketnum]
439
        lea     edx, [edx + thread_data.buffer]
443
        lea     edx, [edx + thread_data.buffer]
440
        mcall   send, , , ,0
444
        xor     esi, esi
-
 
445
        mcall   send
441
 
446
 
Line 442... Line 447...
442
        ret
447
        ret
Line 443... Line 448...
443
 
448
 
444
align 4
449
align 4
Line 483... Line 488...
483
        lea     esi, [esi+5]
488
        lea     esi, [esi+5]
Line 484... Line 489...
484
; Convert the IP
489
; Convert the IP
485
        call    ascii_to_byte
490
        call    ascii_to_byte
486
        mov     bh, al
491
        mov     bl, al
487
        inc     esi             ; skip past ','
492
        inc     esi             ; skip past ','
488
        call    ascii_to_byte
493
        call    ascii_to_byte
489
        mov     bl, al
494
        mov     bh, al
490
        shl     ebx, 16
495
        shl     ebx, 16
491
        inc     esi
496
        inc     esi
492
        call    ascii_to_byte
497
        call    ascii_to_byte
493
        mov     bh, al
498
        mov     bl, al
494
        inc     esi
499
        inc     esi
495
        call    ascii_to_byte
500
        call    ascii_to_byte
496
        mov     bl, al
501
        mov     bh, al
497
        inc     esi
502
        inc     esi
498
 
503
        rol     ebx, 16
-
 
504
 
Line 499... Line 505...
499
; And put it in datasock
505
; And put it in datasock
500
        mov     [edx + thread_data.datasock.sin_addr], ebx
506
        mov     [edx + thread_data.datasock.sin_addr], ebx
Line 501... Line 507...
501
 
507
 
Line 530... Line 536...
530
        mcall   send, [edx + thread_data.socketnum], str221, str221.length, 0    ; 221 - bye!
536
        mcall   send, [edx + thread_data.socketnum], str221, str221.length, 0    ; 221 - bye!
531
        mcall   close;, [edx + thread_data.socketnum]
537
        mcall   close;, [edx + thread_data.socketnum]
532
 
538
 
Line -... Line 539...
-
 
539
        add     esp, 4          ; get rid of call return address
533
        jmp     thread_exit    ; now close this thread
540
        jmp     thread_exit     ; now close this thread
Line 534... Line 541...
534
 
541
 
535
align 4
542
align 4
Line 543... Line 550...
543
        push    esi
550
        push    esi
544
        mov     ecx, [edx + thread_data.datasocketnum]
551
        mov     ecx, [edx + thread_data.datasocketnum]
545
        lea     edx, [edx + thread_data.datasock]
552
        lea     edx, [edx + thread_data.datasock]
546
        mcall   connect, , , sizeof.thread_data.datasock
553
        mov     esi, sizeof.thread_data.datasock
547
        pop     esi
554
        mcall   connect
548
        mov     edx, [esp+4]                                    ; thread_data pointer
555
        pop     esi
-
 
556
        mov     edx, [esp+4]                                    ; thread_data pointer
549
        cmp     eax, -1
557
        cmp     eax, -1
550
        je      socketerror
558
        je      socketerror
551
        mov     [edx + thread_data.datasocketnum], eax
559
  @@:
552
  @@:
560
 
553
 
-
 
554
        push    esi
561
        push    esi
Line 555... Line 562...
555
        call    create_path
562
        call    create_path
556
        pop     esi
563
        pop     esi
557
        dec     edi
564
        dec     edi
Line 599... Line 606...
599
        mov     esi, eax
606
        mov     esi, eax
600
        mov     ecx, [edx + thread_data.datasocketnum]
607
        mov     ecx, [edx + thread_data.datasocketnum]
601
        lea     edx, [edx + thread_data.buffer]
608
        lea     edx, [edx + thread_data.buffer]
602
        mcall   send, , , , 0
609
        xor     esi, esi
603
        pop     ebx
610
        mcall   send
-
 
611
        pop     ebx
604
        pop     ecx
612
        pop     ecx
605
        mov     edx, [esp+4]                                    ; thread_data pointer
613
        mov     edx, [esp+4]                                    ; thread_data pointer
606
        cmp     eax, -1
614
        cmp     eax, -1
607
        je      socketerror
615
        je      socketerror
608
 
616
 
609
        cmp     ecx, BUFFERSIZE
617
        cmp     ecx, BUFFERSIZE
Line 775... Line 783...
775
 
783
 
Line 776... Line 784...
776
align 4
784
align 4
777
create_path:            ; combine home_dir and work_dir strings into fpath
785
create_path:            ; combine home_dir and work_dir strings into fpath
-
 
786
 
778
        lea     edi, [edx + thread_data.fpath]
787
        lea     edi, [edx + thread_data.fpath]
779
        lea     esi, [edx + thread_data.home_dir]
788
        lea     esi, [edx + thread_data.home_dir]
780
        mov     ecx, 1024
789
        mov     ecx, 1024
781
 
-
 
782
  .loop1:
790
  .loop1:
783
        lodsb
791
        lodsb
784
        or      al, al
792
        or      al, al
785
        jz      .next
793
        jz      .next
786
        stosb
794
        stosb
Line 794... Line 802...
794
 
802
 
795
        lea     esi, [edx + thread_data.work_dir]
803
        lea     esi, [edx + thread_data.work_dir]
Line 796... Line 804...
796
        mov     ecx, 1024
804
        mov     ecx, 1024
797
 
805
  .loop2:
798
  .loop2:
-
 
799
        lodsb
806
        lodsb
800
        or      al, al
807
        or      al, al
801
        jz      .done
808
        jz      .done
802
        stosb
809
        stosb
803
        loop    .loop2
810
        loop    .loop2