summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-06-14 22:22:49 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-06-14 22:22:49 +0000
commit36c9a958e483dbc2298ea3e13c52bda4047c8f0d (patch)
treeba76f797a3ec5de80d37a5510d6309e9e3cdfe08 /uisimulator
parentf69c703c53c94aefdb7750331f66b5c94e43f8c5 (diff)
downloadrockbox-36c9a958e483dbc2298ea3e13c52bda4047c8f0d.tar.gz
rockbox-36c9a958e483dbc2298ea3e13c52bda4047c8f0d.zip
translate from rockbox's open() options to the options used by the host
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4745 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/common/io.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c
index e321c1adcc..3f639d557d 100644
--- a/uisimulator/common/io.c
+++ b/uisimulator/common/io.c
@@ -54,6 +54,24 @@ struct mydir {
typedef struct mydir MYDIR;
+static unsigned int rockbox2sim(int opt)
+{
+ int newopt = 0;
+ if(opt & 1)
+ newopt |= O_WRONLY;
+ if(opt & 2)
+ newopt |= O_RDWR;
+ if(opt & 4)
+ newopt |= O_CREAT;
+ if(opt & 8)
+ newopt |= O_APPEND;
+ if(opt & 0x10)
+ newopt |= O_TRUNC;
+
+ return newopt;
+}
+
+
MYDIR *sim_opendir(const char *name)
{
char buffer[256]; /* sufficiently big */
@@ -109,9 +127,10 @@ void sim_closedir(MYDIR *dir)
}
-int sim_open(const char *name, int opts)
+int sim_open(const char *name, int o)
{
char buffer[256]; /* sufficiently big */
+ int opts = rockbox2sim(o);
if(name[0] == '/') {
sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);