#include <../source/TAL/objbase.h>

vhandle_t	V_CALL
vfsDuplicateFileHandle(vhandle_t handle)
{
	vhandle_t dup;
	if(fileControl(handle,pctl_duplicate_handle,&dup))
		return dup;
	else
		return LIBV_INVALID_HANDLE;
}

u8_t	buf[256];

int main()
{
	vhandle_t f, f1;
	logStartConsoleLog();
	logUpperLevel(LOG_TRACE);
	f = fileOpenWrite("test.out");
	fileWrite(f,buf,256);
	fileClose(f);
	f = fileOpenRead("test.out");
	if(!f)
		return -1;
	f1 = vfsDuplicateHandle(f);
	if(!f1)
		return -1;
	fileSeek(f,10,SEEK_SET);
	fileSeek(f1,20,SEEK_SET);
	conPrintf("Positions: %u, %u\n",fileTell(f),fileTell(f1));
	fileClose(f);
	fileClose(f1);
	return 0;
}
