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) | |||
591 | 591 | ||
592 | return pos; | 592 | return pos; |
593 | } | 593 | } |
594 | |||
595 | int filesize(int fd) | ||
596 | { | ||
597 | struct filedesc* file = &openfiles[fd]; | ||
598 | |||
599 | if ( !file->busy ) { | ||
600 | errno = EBADF; | ||
601 | return -1; | ||
602 | } | ||
603 | |||
604 | return file->size; | ||
605 | } | ||
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); | |||
64 | extern int remove(const char* pathname); | 64 | extern int remove(const char* pathname); |
65 | extern int rename(const char* path, const char* newname); | 65 | extern int rename(const char* path, const char* newname); |
66 | extern int ftruncate(int fd, unsigned int size); | 66 | extern int ftruncate(int fd, unsigned int size); |
67 | extern int filesize(int fd); | ||
67 | #endif /* SIMULATOR */ | 68 | #endif /* SIMULATOR */ |
68 | #endif /* __MINGW32__ */ | 69 | #endif /* __MINGW32__ */ |
69 | 70 | ||