diff options
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/x11/file.h | 5 | ||||
-rw-r--r-- | uisimulator/x11/io.c | 26 |
2 files changed, 31 insertions, 0 deletions
diff --git a/uisimulator/x11/file.h b/uisimulator/x11/file.h index 28c2f2c17a..134019148c 100644 --- a/uisimulator/x11/file.h +++ b/uisimulator/x11/file.h | |||
@@ -21,13 +21,18 @@ | |||
21 | #include <sys/types.h> | 21 | #include <sys/types.h> |
22 | 22 | ||
23 | int x11_open(char *name, int opts); | 23 | int x11_open(char *name, int opts); |
24 | int x11_creat(char *name, int mode); | ||
25 | int x11_remove(char *name); | ||
24 | 26 | ||
25 | #define open(x,y) x11_open(x,y) | 27 | #define open(x,y) x11_open(x,y) |
28 | #define creat(x,y) x11_open(x,y) | ||
29 | #define remove(x) x11_remove(x) | ||
26 | 30 | ||
27 | #include "../../firmware/common/file.h" | 31 | #include "../../firmware/common/file.h" |
28 | 32 | ||
29 | extern int open(char* pathname, int flags); | 33 | extern int open(char* pathname, int flags); |
30 | extern int close(int fd); | 34 | extern int close(int fd); |
31 | extern int read(int fd, void* buf, int count); | 35 | extern int read(int fd, void* buf, int count); |
36 | extern int write(int fd, void* buf, int count); | ||
32 | extern int lseek(int fd, int offset, int whence); | 37 | extern int lseek(int fd, int offset, int whence); |
33 | extern int printf(const char *format, ...); | 38 | extern int printf(const char *format, ...); |
diff --git a/uisimulator/x11/io.c b/uisimulator/x11/io.c index 2951b1f4a0..5890254b79 100644 --- a/uisimulator/x11/io.c +++ b/uisimulator/x11/io.c | |||
@@ -109,6 +109,32 @@ int x11_open(char *name, int opts) | |||
109 | return open(name, opts); | 109 | return open(name, opts); |
110 | } | 110 | } |
111 | 111 | ||
112 | int x11_creat(char *name, int mode) | ||
113 | { | ||
114 | char buffer[256]; /* sufficiently big */ | ||
115 | |||
116 | if(name[0] == '/') { | ||
117 | sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); | ||
118 | |||
119 | debugf("We open the real file '%s'\n", buffer); | ||
120 | return creat(buffer, mode); | ||
121 | } | ||
122 | return creat(name, mode); | ||
123 | } | ||
124 | |||
125 | int x11_remove(char *name) | ||
126 | { | ||
127 | char buffer[256]; /* sufficiently big */ | ||
128 | |||
129 | if(name[0] == '/') { | ||
130 | sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); | ||
131 | |||
132 | debugf("We open the real file '%s'\n", buffer); | ||
133 | return remove(buffer); | ||
134 | } | ||
135 | return remove(name); | ||
136 | } | ||
137 | |||
112 | void fat_size(unsigned int* size, unsigned int* free) | 138 | void fat_size(unsigned int* size, unsigned int* free) |
113 | { | 139 | { |
114 | struct statfs fs; | 140 | struct statfs fs; |