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

	extrn	convbuf:byte

PPROC	wlongname, arg_path:DPTR, arg_file:DPTR
	push	ds
	push	si
	push	di
	call	convert
	MMOV	dx,ds
	mov	ax,di
	pop	di
	pop	si
	pop	ds
	ret
PEND	wlongname

PPROC	wlongpath, arg_path:DPTR, arg_file:DPTR
	push	ds
	push	si
	push	di
	call	convert
	MMOV	dx,ds
	mov	ax,si
	pop	di
	pop	si
	pop	ds
	ret
PEND	wlongpath

_TEXT	SEGMENT

argfile	equ	[bp+ARG1]
argpath	equ	[bp+ARG1+DPTRZ]

convert PROC
	push	ds
	push	offset convbuf
	pushm	argpath
	cmp	word ptr argfile,0
	jnz	convert_00
	call	strcpy
	jmp	convert_01
    convert_00:
	pushm	argfile
	call	strfcat
    convert_01:
	mov	es,dx
	mov	si,ax
	mov	di,ax
  ifdef __LFN__
	cmp	_ifsmgr,0
	jz	convert_02
	mov	ax,7160h
	mov	cx,2
	int	21h
    convert_02:
  endif
	invoke	strfn, ds::di
	mov	di,ax
	ret
convert ENDP

_TEXT	ENDS

	END
