blob: 1c43b92e3ee057e5763c2878c470a10ac2b706d7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include <psx.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
int stat(const char *path, struct stat *sb)
{
struct DIRENTRY dir_e;
if(firstfile((char*)path, &dir_e) == NULL)
return -1;
sb->st_size = dir_e.size;
if(strncmp(path, "cdrom:", 6) == 0)
sb->st_blksize = 2048;
else if(strncmp(path, "bu00:", 5) == 0 ||
strncmp(path, "bu10:", 5) == 0)
sb->st_blksize = 128;
else
// not a real blocksize, will be there just as a placeholder
sb->st_blksize = 1024;
sb->st_blocks =
sb->st_size / sb->st_blksize;
if(sb->st_size % sb->st_blksize)
sb->st_blocks++;
return 0;
}
|