summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-02-22 12:19:12 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-02-22 12:19:12 +0000
commit22b7701fe75cce9afdbc27046821dc089f9e7dac (patch)
treeca5b4f0428fad0fc9c775dfb0ac879ddee863846 /apps
parent376057d2b67bae0a7b24ae1715d3cbb0b540b7a9 (diff)
downloadrockbox-22b7701fe75cce9afdbc27046821dc089f9e7dac.tar.gz
rockbox-22b7701fe75cce9afdbc27046821dc089f9e7dac.zip
Build cleanup and general fixes. fprintf() is now fdprintf(), the separation
between uisimulator files and firmware/apps files are better done. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6031 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/Makefile16
-rw-r--r--apps/playlist.c18
-rw-r--r--apps/plugin.c60
-rw-r--r--apps/plugin.h38
-rw-r--r--apps/plugins/Makefile6
-rw-r--r--apps/plugins/calendar.c14
-rw-r--r--apps/plugins/lib/configfile.c8
-rw-r--r--apps/settings.c20
8 files changed, 86 insertions, 94 deletions
diff --git a/apps/Makefile b/apps/Makefile
index bcdc1ef265..4f80e045b7 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -43,6 +43,8 @@ MAXOUTFILE = $(OBJDIR)/romstart
43ifdef SIMVER 43ifdef SIMVER
44# this is a sim build 44# this is a sim build
45all: $(OBJDIR)/$(BINARY) $(CODECS) $(ROCKS) 45all: $(OBJDIR)/$(BINARY) $(CODECS) $(ROCKS)
46 @$(MAKE) -C $(SIMDIR)
47 @$(MAKE) -C $(ROOTDIR)/uisimulator/common
46else 48else
47# regular target build 49# regular target build
48all: $(OBJDIR)/$(BINARY) $(FLASHFILE) $(CODECS) $(ROCKS) $(ARCHOSROM) 50all: $(OBJDIR)/$(BINARY) $(FLASHFILE) $(CODECS) $(ROCKS) $(ARCHOSROM)
@@ -101,12 +103,22 @@ $(OBJDIR)/$(BINARY) : $(OBJDIR)/rockbox.bin
101 103
102else 104else
103# this is a simulator build 105# this is a simulator build
104$(OBJDIR)/$(BINARY) : $(OBJS) $(OBJDIR)/librockbox.a $(DEPFILE) $(OBJDIR)/libsim.a 106
107ifeq ($(SIMVER), win32)
108# OK, this is ugly but we need it on the link line to make it do right
109EXTRAOBJ = $(OBJDIR)/uisw32-res.o
110endif
111
112
113$(OBJDIR)/$(BINARY) : $(OBJS) $(OBJDIR)/librockbox.a $(DEPFILE) $(OBJDIR)/libsim.a $(OBJDIR)/libcomsim.a
105 @echo "LD $(BINARY)" 114 @echo "LD $(BINARY)"
106 $(CC) $(GCCOPTS) -o $@ $(OBJS) $(LDOPTS) -L$(OBJDIR) -lrockbox -lsim -Wl,-Map,$(OBJDIR)/rockbox.map 115 $(CC) $(GCCOPTS) -o $@ $(OBJS) -L$(OBJDIR) -lrockbox -lsim -lcomsim $(LDOPTS) $(EXTRAOBJ) -Wl,-Map,$(OBJDIR)/rockbox.map
107 116
108$(OBJDIR)/libsim.a: 117$(OBJDIR)/libsim.a:
109 @$(MAKE) -C $(SIMDIR) 118 @$(MAKE) -C $(SIMDIR)
119
120$(OBJDIR)/libcomsim.a:
121 @$(MAKE) -C $(ROOTDIR)/uisimulator/common
110endif 122endif
111 123
112$(OBJDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin 124$(OBJDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin
diff --git a/apps/playlist.c b/apps/playlist.c
index 5e7f679800..cb9d2ba3ea 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -231,7 +231,7 @@ static void new_playlist(struct playlist_info* playlist, const char *dir,
231 231
232 if (playlist->control_fd >= 0) 232 if (playlist->control_fd >= 0)
233 { 233 {
234 if (fprintf(playlist->control_fd, "P:%d:%s:%s\n", 234 if (fdprintf(playlist->control_fd, "P:%d:%s:%s\n",
235 PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) 235 PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0)
236 fsync(playlist->control_fd); 236 fsync(playlist->control_fd);
237 else 237 else
@@ -279,7 +279,7 @@ static int check_control(struct playlist_info* playlist)
279 279
280 playlist->filename[playlist->dirlen-1] = '\0'; 280 playlist->filename[playlist->dirlen-1] = '\0';
281 281
282 if (fprintf(playlist->control_fd, "P:%d:%s:%s\n", 282 if (fdprintf(playlist->control_fd, "P:%d:%s:%s\n",
283 PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) 283 PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0)
284 fsync(playlist->control_fd); 284 fsync(playlist->control_fd);
285 else 285 else
@@ -499,13 +499,13 @@ static int add_track_to_playlist(struct playlist_info* playlist,
499 499
500 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) 500 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0)
501 { 501 {
502 if (fprintf(playlist->control_fd, "%c:%d:%d:", (queue?'Q':'A'), 502 if (fdprintf(playlist->control_fd, "%c:%d:%d:", (queue?'Q':'A'),
503 position, playlist->last_insert_pos) > 0) 503 position, playlist->last_insert_pos) > 0)
504 { 504 {
505 /* save the position in file where track name is written */ 505 /* save the position in file where track name is written */
506 seek_pos = lseek(playlist->control_fd, 0, SEEK_CUR); 506 seek_pos = lseek(playlist->control_fd, 0, SEEK_CUR);
507 507
508 if (fprintf(playlist->control_fd, "%s\n", filename) > 0) 508 if (fdprintf(playlist->control_fd, "%s\n", filename) > 0)
509 result = 0; 509 result = 0;
510 } 510 }
511 } 511 }
@@ -697,7 +697,7 @@ static int remove_track_from_playlist(struct playlist_info* playlist,
697 697
698 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) 698 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0)
699 { 699 {
700 if (fprintf(playlist->control_fd, "D:%d\n", position) > 0) 700 if (fdprintf(playlist->control_fd, "D:%d\n", position) > 0)
701 { 701 {
702 fsync(playlist->control_fd); 702 fsync(playlist->control_fd);
703 result = 0; 703 result = 0;
@@ -1098,10 +1098,10 @@ static int flush_pending_control(struct playlist_info* playlist)
1098 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) 1098 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0)
1099 { 1099 {
1100 if (global_settings.resume_seed == 0) 1100 if (global_settings.resume_seed == 0)
1101 result = fprintf(playlist->control_fd, "U:%d\n", 1101 result = fdprintf(playlist->control_fd, "U:%d\n",
1102 playlist->first_index); 1102 playlist->first_index);
1103 else 1103 else
1104 result = fprintf(playlist->control_fd, "S:%d:%d\n", 1104 result = fdprintf(playlist->control_fd, "S:%d:%d\n",
1105 global_settings.resume_seed, playlist->first_index); 1105 global_settings.resume_seed, playlist->first_index);
1106 1106
1107 if (result > 0) 1107 if (result > 0)
@@ -1737,7 +1737,7 @@ int playlist_next(int steps)
1737 1737
1738 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) 1738 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0)
1739 { 1739 {
1740 if (fprintf(playlist->control_fd, "R\n") > 0) 1740 if (fdprintf(playlist->control_fd, "R\n") > 0)
1741 { 1741 {
1742 fsync(playlist->control_fd); 1742 fsync(playlist->control_fd);
1743 result = 0; 1743 result = 0;
@@ -2407,7 +2407,7 @@ int playlist_save(struct playlist_info* playlist, char *filename)
2407 break; 2407 break;
2408 } 2408 }
2409 2409
2410 if (fprintf(fd, "%s\n", tmp_buf) < 0) 2410 if (fdprintf(fd, "%s\n", tmp_buf) < 0)
2411 { 2411 {
2412 splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); 2412 splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
2413 result = -1; 2413 result = -1;
diff --git a/apps/plugin.c b/apps/plugin.c
index 10daeaf325..194ec34484 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -50,18 +50,6 @@
50#include "widgets.h" 50#include "widgets.h"
51#endif 51#endif
52 52
53#ifdef SIMULATOR
54 #include <debug.h>
55 #ifdef WIN32
56 #include "plugin-win32.h"
57 #else
58 #include <dlfcn.h>
59 #endif
60 #define PREFIX(_x_) sim_ ## _x_
61#else
62#define PREFIX(_x_) _x_
63#endif
64
65#if MEM >= 32 53#if MEM >= 32
66#define PLUGIN_BUFFER_SIZE 0xC0000 54#define PLUGIN_BUFFER_SIZE 0xC0000
67#else 55#else
@@ -70,7 +58,9 @@
70 58
71#ifdef SIMULATOR 59#ifdef SIMULATOR
72static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE]; 60static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE];
61void *sim_plugin_load(char *plugin, int *fd);
73#else 62#else
63#define sim_plugin_close(x)
74extern unsigned char pluginbuf[]; 64extern unsigned char pluginbuf[];
75#include "bitswap.h" 65#include "bitswap.h"
76#endif 66#endif
@@ -142,16 +132,16 @@ static const struct plugin_api rockbox_api = {
142 132
143 /* file */ 133 /* file */
144 (open_func)PREFIX(open), 134 (open_func)PREFIX(open),
145 PREFIX(close), 135 close,
146 (read_func)read, 136 (read_func)read,
147 lseek, 137 lseek,
148 (creat_func)PREFIX(creat), 138 (creat_func)PREFIX(creat),
149 (write_func)write, 139 (write_func)write,
150 PREFIX(remove), 140 PREFIX(remove),
151 PREFIX(rename), 141 PREFIX(rename),
152 ftruncate, 142 PREFIX(ftruncate),
153 PREFIX(filesize), 143 PREFIX(filesize),
154 fprintf, 144 fdprintf,
155 read_line, 145 read_line,
156 settings_parseline, 146 settings_parseline,
157#ifndef SIMULATOR 147#ifndef SIMULATOR
@@ -189,6 +179,9 @@ static const struct plugin_api rockbox_api = {
189 memcpy, 179 memcpy,
190 _ctype_, 180 _ctype_,
191 atoi, 181 atoi,
182 strchr,
183 strcat,
184 memcmp,
192 185
193 /* sound */ 186 /* sound */
194 mpeg_sound_set, 187 mpeg_sound_set,
@@ -201,7 +194,7 @@ static const struct plugin_api rockbox_api = {
201#endif 194#endif
202 195
203 /* playback control */ 196 /* playback control */
204 mpeg_play, 197 PREFIX(mpeg_play),
205 mpeg_stop, 198 mpeg_stop,
206 mpeg_pause, 199 mpeg_pause,
207 mpeg_resume, 200 mpeg_resume,
@@ -264,10 +257,6 @@ static const struct plugin_api rockbox_api = {
264 257
265 /* new stuff at the end, sort into place next time 258 /* new stuff at the end, sort into place next time
266 the API gets incompatible */ 259 the API gets incompatible */
267
268 strchr,
269 strcat,
270 memcmp
271}; 260};
272 261
273int plugin_load(const char* plugin, void* parameter) 262int plugin_load(const char* plugin, void* parameter)
@@ -275,12 +264,8 @@ int plugin_load(const char* plugin, void* parameter)
275 enum plugin_status (*plugin_start)(struct plugin_api* api, void* param); 264 enum plugin_status (*plugin_start)(struct plugin_api* api, void* param);
276 int rc; 265 int rc;
277 char buf[64]; 266 char buf[64];
278#ifdef SIMULATOR
279 void* pd;
280 char path[256];
281#else
282 int fd; 267 int fd;
283#endif 268
284#ifdef HAVE_LCD_BITMAP 269#ifdef HAVE_LCD_BITMAP
285 int xm,ym; 270 int xm,ym;
286#endif 271#endif
@@ -301,26 +286,9 @@ int plugin_load(const char* plugin, void* parameter)
301 lcd_clear_display(); 286 lcd_clear_display();
302#endif 287#endif
303#ifdef SIMULATOR 288#ifdef SIMULATOR
304 snprintf(path, sizeof path, "archos%s", plugin); 289 plugin_start = sim_plugin_load(plugin, &fd);
305 290 if(!plugin_start)
306 pd = dlopen(path, RTLD_NOW);
307 if (!pd) {
308 snprintf(buf, sizeof buf, str(LANG_PLUGIN_CANT_OPEN), plugin);
309 splash(HZ*2, true, buf);
310 DEBUGF("dlopen(%s): %s\n",path,dlerror());
311 dlclose(pd);
312 return -1; 291 return -1;
313 }
314
315 plugin_start = dlsym(pd, "plugin_start");
316 if (!plugin_start) {
317 plugin_start = dlsym(pd, "_plugin_start");
318 if (!plugin_start) {
319 splash(HZ*2, true, "Can't find entry point");
320 dlclose(pd);
321 return -1;
322 }
323 }
324#else 292#else
325 fd = open(plugin, O_RDONLY); 293 fd = open(plugin, O_RDONLY);
326 if (fd < 0) { 294 if (fd < 0) {
@@ -379,9 +347,7 @@ int plugin_load(const char* plugin, void* parameter)
379 break; 347 break;
380 } 348 }
381 349
382#ifdef SIMULATOR 350 sim_plugin_close(fd);
383 dlclose(pd);
384#endif
385 351
386#ifdef HAVE_LCD_BITMAP 352#ifdef HAVE_LCD_BITMAP
387 /* restore margins */ 353 /* restore margins */
diff --git a/apps/plugin.h b/apps/plugin.h
index 96a9aabe1d..896565e9a0 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -32,6 +32,7 @@
32#include <stdbool.h> 32#include <stdbool.h>
33#include <stdio.h> 33#include <stdio.h>
34#include <stdlib.h> 34#include <stdlib.h>
35#include <sys/types.h>
35#include "config.h" 36#include "config.h"
36#include "dir.h" 37#include "dir.h"
37#include "kernel.h" 38#include "kernel.h"
@@ -51,7 +52,9 @@
51 52
52#ifdef PLUGIN 53#ifdef PLUGIN
53#if defined(DEBUG) || defined(SIMULATOR) 54#if defined(DEBUG) || defined(SIMULATOR)
55#undef DEBUGF
54#define DEBUGF rb->debugf 56#define DEBUGF rb->debugf
57#undef LDEBUGF
55#define LDEBUGF rb->debugf 58#define LDEBUGF rb->debugf
56#else 59#else
57#define DEBUGF(...) 60#define DEBUGF(...)
@@ -59,13 +62,19 @@
59#endif 62#endif
60#endif 63#endif
61 64
65#ifdef SIMULATOR
66#define PREFIX(_x_) sim_ ## _x_
67#else
68#define PREFIX(_x_) _x_
69#endif
70
62/* increase this every time the api struct changes */ 71/* increase this every time the api struct changes */
63#define PLUGIN_API_VERSION 31 72#define PLUGIN_API_VERSION 32
64 73
65/* update this to latest version if a change to the api struct breaks 74/* update this to latest version if a change to the api struct breaks
66 backwards compatibility (and please take the opportunity to sort in any 75 backwards compatibility (and please take the opportunity to sort in any
67 new function which are "waiting" at the end of the function table) */ 76 new function which are "waiting" at the end of the function table) */
68#define PLUGIN_MIN_API_VERSION 29 77#define PLUGIN_MIN_API_VERSION 32
69 78
70/* plugin return codes */ 79/* plugin return codes */
71enum plugin_status { 80enum plugin_status {
@@ -165,17 +174,17 @@ struct plugin_api {
165 void (*button_clear_queue)(void); 174 void (*button_clear_queue)(void);
166 175
167 /* file */ 176 /* file */
168 int (*open)(const char* pathname, int flags); 177 int (*PREFIX(open))(const char* pathname, int flags);
169 int (*close)(int fd); 178 int (*close)(int fd);
170 ssize_t (*read)(int fd, void* buf, size_t count); 179 ssize_t (*read)(int fd, void* buf, size_t count);
171 off_t (*lseek)(int fd, off_t offset, int whence); 180 off_t (*lseek)(int fd, off_t offset, int whence);
172 int (*creat)(const char *pathname, mode_t mode); 181 int (*PREFIX(creat))(const char *pathname, mode_t mode);
173 ssize_t (*write)(int fd, const void* buf, size_t count); 182 ssize_t (*write)(int fd, const void* buf, size_t count);
174 int (*remove)(const char* pathname); 183 int (*PREFIX(remove))(const char* pathname);
175 int (*rename)(const char* path, const char* newname); 184 int (*PREFIX(rename))(const char* path, const char* newname);
176 int (*ftruncate)(int fd, off_t length); 185 int (*PREFIX(ftruncate))(int fd, off_t length);
177 off_t (*filesize)(int fd); 186 off_t (*PREFIX(filesize))(int fd);
178 int (*fprintf)(int fd, const char *fmt, ...); 187 int (*fdprintf)(int fd, const char *fmt, ...);
179 int (*read_line)(int fd, char* buffer, int buffer_size); 188 int (*read_line)(int fd, char* buffer, int buffer_size);
180 bool (*settings_parseline)(char* line, char** name, char** value); 189 bool (*settings_parseline)(char* line, char** name, char** value);
181#ifndef SIMULATOR 190#ifndef SIMULATOR
@@ -188,7 +197,7 @@ struct plugin_api {
188 struct dirent* (*readdir)(DIR* dir); 197 struct dirent* (*readdir)(DIR* dir);
189 198
190 /* kernel/ system */ 199 /* kernel/ system */
191 void (*sleep)(int ticks); 200 void (*PREFIX(sleep))(int ticks);
192 void (*yield)(void); 201 void (*yield)(void);
193 long* current_tick; 202 long* current_tick;
194 long (*default_event_handler)(long event); 203 long (*default_event_handler)(long event);
@@ -213,6 +222,9 @@ struct plugin_api {
213 void* (*memcpy)(void *out, const void *in, size_t n); 222 void* (*memcpy)(void *out, const void *in, size_t n);
214 const char *_ctype_; 223 const char *_ctype_;
215 int (*atoi)(const char *str); 224 int (*atoi)(const char *str);
225 char *(*strchr)(const char *s, int c);
226 char *(*strcat)(char *s1, const char *s2);
227 int (*memcmp)(const void *s1, const void *s2, size_t n);
216 228
217 /* sound */ 229 /* sound */
218 void (*mpeg_sound_set)(int setting, int value); 230 void (*mpeg_sound_set)(int setting, int value);
@@ -225,7 +237,7 @@ struct plugin_api {
225#endif 237#endif
226 238
227 /* playback control */ 239 /* playback control */
228 void (*mpeg_play)(int offset); 240 void (*PREFIX(mpeg_play))(int offset);
229 void (*mpeg_stop)(void); 241 void (*mpeg_stop)(void);
230 void (*mpeg_pause)(void); 242 void (*mpeg_pause)(void);
231 void (*mpeg_resume)(void); 243 void (*mpeg_resume)(void);
@@ -295,10 +307,6 @@ struct plugin_api {
295 307
296 /* new stuff at the end, sort into place next time 308 /* new stuff at the end, sort into place next time
297 the API gets incompatible */ 309 the API gets incompatible */
298
299 char *(*strchr)(const char *s, int c);
300 char *(*strcat)(char *s1, const char *s2);
301 int (*memcmp)(const void *s1, const void *s2, size_t n);
302}; 310};
303 311
304/* defined by the plugin loader (plugin.c) */ 312/* defined by the plugin loader (plugin.c) */
diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile
index 9549959bbd..ef506a9c4a 100644
--- a/apps/plugins/Makefile
+++ b/apps/plugins/Makefile
@@ -71,7 +71,13 @@ $(OBJDIR)/%.rock : $(OBJDIR)/%.o $(APPSDIR)/plugin.h
71 @echo "DLL $@" 71 @echo "DLL $@"
72 @$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $< 72 @$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $<
73 @$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $< $(OBJDIR)/libplugin.a -o $@ 73 @$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $< $(OBJDIR)/libplugin.a -o $@
74ifeq ($(UNAME),CYGWIN)
75# 'x' must be kept or you'll have "Win32 error 5"
76# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
77# #define ERROR_ACCESS_DENIED 5L
78else
74 @chmod -x $@ 79 @chmod -x $@
80endif
75endif # end of win32-simulator 81endif # end of win32-simulator
76 82
77endif # end of simulator section 83endif # end of simulator section
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c
index 44b3685c40..8627c9a558 100644
--- a/apps/plugins/calendar.c
+++ b/apps/plugins/calendar.c
@@ -325,13 +325,13 @@ static bool save_memo(int changed, bool new_mod, struct shown *shown)
325 } 325 }
326 if (new_mod) 326 if (new_mod)
327 { 327 {
328 rb->fprintf(fq, "%02d%02d%04d%01d%01d%s\n", 328 rb->fdprintf(fq, "%02d%02d%04d%01d%01d%s\n",
329 memos[changed].day, 329 memos[changed].day,
330 memos[changed].month, 330 memos[changed].month,
331 memos[changed].year, 331 memos[changed].year,
332 memos[changed].wday, 332 memos[changed].wday,
333 memos[changed].type, 333 memos[changed].type,
334 memos[changed].message); 334 memos[changed].message);
335 } 335 }
336 rb->lseek(fp, memos[changed].file_pointer_end, SEEK_SET); 336 rb->lseek(fp, memos[changed].file_pointer_end, SEEK_SET);
337 for (i = memos[changed].file_pointer_end; 337 for (i = memos[changed].file_pointer_end;
diff --git a/apps/plugins/lib/configfile.c b/apps/plugins/lib/configfile.c
index ff4809a3f4..f2f0a39da0 100644
--- a/apps/plugins/lib/configfile.c
+++ b/apps/plugins/lib/configfile.c
@@ -38,24 +38,24 @@ int configfile_save(const char *filename, struct configdata *cfg,
38 if(fd < 0) 38 if(fd < 0)
39 return fd*10 - 1; 39 return fd*10 - 1;
40 40
41 cfg_rb->fprintf(fd, "file version: %d\n", version); 41 cfg_rb->fdprintf(fd, "file version: %d\n", version);
42 42
43 for(i = 0;i < num_items;i++) { 43 for(i = 0;i < num_items;i++) {
44 switch(cfg[i].type) { 44 switch(cfg[i].type) {
45 case TYPE_INT: 45 case TYPE_INT:
46 cfg_rb->fprintf(fd, "%s: %d\n", 46 cfg_rb->fdprintf(fd, "%s: %d\n",
47 cfg[i].name, 47 cfg[i].name,
48 *cfg[i].val); 48 *cfg[i].val);
49 break; 49 break;
50 50
51 case TYPE_ENUM: 51 case TYPE_ENUM:
52 cfg_rb->fprintf(fd, "%s: %s\n", 52 cfg_rb->fdprintf(fd, "%s: %s\n",
53 cfg[i].name, 53 cfg[i].name,
54 cfg[i].values[*cfg[i].val]); 54 cfg[i].values[*cfg[i].val]);
55 break; 55 break;
56 56
57 case TYPE_STRING: 57 case TYPE_STRING:
58 cfg_rb->fprintf(fd, "%s: %s\n", 58 cfg_rb->fdprintf(fd, "%s: %s\n",
59 cfg[i].name, 59 cfg[i].name,
60 cfg[i].string); 60 cfg[i].string);
61 break; 61 break;
diff --git a/apps/settings.c b/apps/settings.c
index ba80bfb9d9..86c1178745 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -1127,13 +1127,13 @@ static void save_cfg_table(const struct bit_entry* p_table, int count, int fd)
1127 1127
1128 if (p_run->cfg_val == NULL) /* write as number */ 1128 if (p_run->cfg_val == NULL) /* write as number */
1129 { 1129 {
1130 fprintf(fd, "%s: %ld\r\n", p_run->cfg_name, value); 1130 fdprintf(fd, "%s: %ld\r\n", p_run->cfg_name, value);
1131 } 1131 }
1132 else /* write as item */ 1132 else /* write as item */
1133 { 1133 {
1134 const char* p = p_run->cfg_val; 1134 const char* p = p_run->cfg_val;
1135 1135
1136 fprintf(fd, "%s: ", p_run->cfg_name); 1136 fdprintf(fd, "%s: ", p_run->cfg_name);
1137 1137
1138 while(value >= 0) 1138 while(value >= 0)
1139 { 1139 {
@@ -1146,9 +1146,9 @@ static void save_cfg_table(const struct bit_entry* p_table, int count, int fd)
1146 write(fd, &c, 1); /* char by char, this is lame, OK */ 1146 write(fd, &c, 1); /* char by char, this is lame, OK */
1147 } 1147 }
1148 1148
1149 fprintf(fd, "\r\n"); 1149 fdprintf(fd, "\r\n");
1150 if (p_run->cfg_val != off_on) /* explaination for non-bool */ 1150 if (p_run->cfg_val != off_on) /* explaination for non-bool */
1151 fprintf(fd, "# (possible values: %s)\r\n", p_run->cfg_val); 1151 fdprintf(fd, "# (possible values: %s)\r\n", p_run->cfg_val);
1152 } 1152 }
1153 } 1153 }
1154} 1154}
@@ -1195,21 +1195,21 @@ bool settings_save_config(void)
1195 return false; 1195 return false;
1196 } 1196 }
1197 1197
1198 fprintf(fd, "# >>> .cfg file created by rockbox %s <<<\r\n", appsversion); 1198 fdprintf(fd, "# .cfg file created by rockbox %s - ", appsversion);
1199 fprintf(fd, "# >>> http://rockbox.haxx.se <<<\r\n#\r\n"); 1199 fdprintf(fd, "http://www.rockbox.org\r\n#\r\n");
1200 fprintf(fd, "#\r\n# wps / language / font \r\n#\r\n"); 1200 fdprintf(fd, "#\r\n# wps / language / font \r\n#\r\n");
1201 1201
1202 if (global_settings.wps_file[0] != 0) 1202 if (global_settings.wps_file[0] != 0)
1203 fprintf(fd, "wps: %s/%s.wps\r\n", ROCKBOX_DIR, 1203 fdprintf(fd, "wps: %s/%s.wps\r\n", ROCKBOX_DIR,
1204 global_settings.wps_file); 1204 global_settings.wps_file);
1205 1205
1206 if (global_settings.lang_file[0] != 0) 1206 if (global_settings.lang_file[0] != 0)
1207 fprintf(fd, "lang: %s/%s.lng\r\n", ROCKBOX_DIR LANG_DIR, 1207 fdprintf(fd, "lang: %s/%s.lng\r\n", ROCKBOX_DIR LANG_DIR,
1208 global_settings.lang_file); 1208 global_settings.lang_file);
1209 1209
1210#ifdef HAVE_LCD_BITMAP 1210#ifdef HAVE_LCD_BITMAP
1211 if (global_settings.font_file[0] != 0) 1211 if (global_settings.font_file[0] != 0)
1212 fprintf(fd, "font: %s/%s.fnt\r\n", ROCKBOX_DIR FONT_DIR, 1212 fdprintf(fd, "font: %s/%s.fnt\r\n", ROCKBOX_DIR FONT_DIR,
1213 global_settings.font_file); 1213 global_settings.font_file);
1214#endif 1214#endif
1215 1215