diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-06-14 22:22:49 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-06-14 22:22:49 +0000 |
commit | 36c9a958e483dbc2298ea3e13c52bda4047c8f0d (patch) | |
tree | ba76f797a3ec5de80d37a5510d6309e9e3cdfe08 /uisimulator | |
parent | f69c703c53c94aefdb7750331f66b5c94e43f8c5 (diff) | |
download | rockbox-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.c | 21 |
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 { | |||
54 | 54 | ||
55 | typedef struct mydir MYDIR; | 55 | typedef struct mydir MYDIR; |
56 | 56 | ||
57 | static unsigned int rockbox2sim(int opt) | ||
58 | { | ||
59 | int newopt = 0; | ||
60 | if(opt & 1) | ||
61 | newopt |= O_WRONLY; | ||
62 | if(opt & 2) | ||
63 | newopt |= O_RDWR; | ||
64 | if(opt & 4) | ||
65 | newopt |= O_CREAT; | ||
66 | if(opt & 8) | ||
67 | newopt |= O_APPEND; | ||
68 | if(opt & 0x10) | ||
69 | newopt |= O_TRUNC; | ||
70 | |||
71 | return newopt; | ||
72 | } | ||
73 | |||
74 | |||
57 | MYDIR *sim_opendir(const char *name) | 75 | MYDIR *sim_opendir(const char *name) |
58 | { | 76 | { |
59 | char buffer[256]; /* sufficiently big */ | 77 | char buffer[256]; /* sufficiently big */ |
@@ -109,9 +127,10 @@ void sim_closedir(MYDIR *dir) | |||
109 | } | 127 | } |
110 | 128 | ||
111 | 129 | ||
112 | int sim_open(const char *name, int opts) | 130 | int sim_open(const char *name, int o) |
113 | { | 131 | { |
114 | char buffer[256]; /* sufficiently big */ | 132 | char buffer[256]; /* sufficiently big */ |
133 | int opts = rockbox2sim(o); | ||
115 | 134 | ||
116 | if(name[0] == '/') { | 135 | if(name[0] == '/') { |
117 | sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); | 136 | sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); |