EMILE/libblock/block_lseek.c

32 lines
411 B
C
Raw Normal View History

2005-11-23 22:39:03 +00:00
/*
*
* (c) 2005 Laurent Vivier <Laurent@lvivier.info>
2005-11-23 22:39:03 +00:00
*
*/
#include "libblock.h"
int block_lseek(block_FILE *file, off_t offset, int whence)
{
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;
}