diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2003-03-18 00:39:57 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2003-03-18 00:39:57 +0000 |
commit | e98bad5b386d58a6add0b7db31ea7090cb791b55 (patch) | |
tree | 34d05b75f305da2bba228af448e9de953250136c /firmware | |
parent | 55fc6df87491f20e0776b167cf58e84d49e00efd (diff) | |
download | rockbox-e98bad5b386d58a6add0b7db31ea7090cb791b55.tar.gz rockbox-e98bad5b386d58a6add0b7db31ea7090cb791b55.zip |
Added the filesize() function
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3473 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/common/file.c | 12 | ||||
-rw-r--r-- | firmware/include/file.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c index d2cad7c647..8c0f9a8951 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c @@ -591,3 +591,15 @@ int lseek(int fd, int offset, int whence) return pos; } + +int filesize(int fd) +{ + struct filedesc* file = &openfiles[fd]; + + if ( !file->busy ) { + errno = EBADF; + return -1; + } + + return file->size; +} diff --git a/firmware/include/file.h b/firmware/include/file.h index 75c55bbac9..1a2f8e55be 100644 --- a/firmware/include/file.h +++ b/firmware/include/file.h @@ -64,6 +64,7 @@ extern int write(int fd, void* buf, int count); extern int remove(const char* pathname); extern int rename(const char* path, const char* newname); extern int ftruncate(int fd, unsigned int size); +extern int filesize(int fd); #endif /* SIMULATOR */ #endif /* __MINGW32__ */ |