2005-12-01 22:14:27 +00:00
|
|
|
/*
|
|
|
|
*
|
2006-09-15 14:55:39 +00:00
|
|
|
* (c) 2005 Laurent Vivier <Laurent@lvivier.info>
|
2005-12-01 22:14:27 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "libcontainer.h"
|
2008-04-20 16:20:54 +00:00
|
|
|
#include "container.h"
|
2005-12-01 22:14:27 +00:00
|
|
|
|
2008-04-20 16:20:54 +00:00
|
|
|
int container_lseek(stream_FILE *_file, off_t offset, int whence)
|
2005-12-01 22:14:27 +00:00
|
|
|
{
|
2008-04-20 16:20:54 +00:00
|
|
|
container_FILE *file = (container_FILE*)_file;
|
2005-12-01 22:14:27 +00:00
|
|
|
long new_offset;
|
|
|
|
|
|
|
|
switch(whence)
|
|
|
|
{
|
|
|
|
case SEEK_SET:
|
|
|
|
new_offset = offset;
|
|
|
|
break;
|
|
|
|
case SEEK_CUR:
|
|
|
|
new_offset = file->offset + offset;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (new_offset < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
file->offset = new_offset;
|
|
|
|
|
|
|
|
return new_offset;
|
|
|
|
}
|