include	clib.inc
include	dir.inc
include	string.inc
include	dos.inc

_TEXT	SEGMENT

recursive proc dist pascal public file_name:dword,
	src_path:dword, dst_path:dword
local	tmp1[WMAXPATH]:byte
local	tmp2[WMAXPATH]:byte
local	p1:dword
local	p2:dword
	mov dx,ss
	lea ax,tmp1
        stom p1
        lea ax,tmp2
        stom p2
  ifdef __LFN__
	invoke wlongpath, src_path, file_name
	invoke strcpy, p1, dx::ax
	invoke wlongpath, dst_path, 0
	invoke strcpy, p2, dx::ax
  else
	invoke strfcat, p1, src_path, file_name
	invoke strcpy, p2, dst_path
  endif
	invoke strfn, p1
	invoke strfcat, p2, p2, dx::ax
        invoke strlen, p1
        mov bx,word ptr p1
	add bx,ax
	mov word ptr [bx],005Ch
	inc ax
	invoke strnicmp, p1, p2, ax
	test ax,ax
	jz recursive_end
	mov ax,-1
    recursive_end:
	inc ax
	ret
recursive endp

_TEXT	ENDS

	END
