diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-07-03 22:16:11 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-07-03 22:16:11 +0000 |
commit | 0d4560cb0305029fa5f0739670286176ab47cb65 (patch) | |
tree | 9899f4324664a77e6a5884fdd1541818a28a2172 /apps/plugins/pdbox/PDa/src/s_file.c | |
parent | eabeb928ddfdbe5fc6379efb87d9522803310649 (diff) | |
download | rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.gz rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.zip |
Accept FS #10244 by Wincent Balin: more pdbox work done for GSoC; also some keyword and line-ending fixes by me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21626 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/s_file.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/s_file.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/apps/plugins/pdbox/PDa/src/s_file.c b/apps/plugins/pdbox/PDa/src/s_file.c index 27825d5948..f98741cf2a 100644 --- a/apps/plugins/pdbox/PDa/src/s_file.c +++ b/apps/plugins/pdbox/PDa/src/s_file.c | |||
@@ -6,14 +6,32 @@ | |||
6 | * this file contains file-handling routines. | 6 | * this file contains file-handling routines. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #ifdef ROCKBOX | ||
10 | #include "plugin.h" | ||
11 | #include "pdbox.h" | ||
12 | #include "m_pd.h" | ||
13 | #include "s_stuff.h" | ||
14 | #else /* ROCKBOX */ | ||
9 | #include "m_pd.h" | 15 | #include "m_pd.h" |
10 | #include "s_stuff.h" | 16 | #include "s_stuff.h" |
11 | #include <sys/types.h> | 17 | #include <sys/types.h> |
12 | #include <sys/stat.h> | 18 | #include <sys/stat.h> |
19 | #endif /* ROCKBOX */ | ||
13 | 20 | ||
14 | /* LATER delete this? -- replaced by find_via_path() in s_path.c */ | 21 | /* LATER delete this? -- replaced by find_via_path() in s_path.c */ |
15 | int sys_isreadablefile(const char *s) | 22 | int sys_isreadablefile(const char *s) |
16 | { | 23 | { |
24 | #ifdef ROCKBOX | ||
25 | int fd; | ||
26 | |||
27 | if((fd = open(s, O_RDONLY))) | ||
28 | { | ||
29 | close(fd); | ||
30 | return 1; | ||
31 | } | ||
32 | else | ||
33 | return 0; | ||
34 | #else /* ROCKBOX */ | ||
17 | struct stat statbuf; | 35 | struct stat statbuf; |
18 | int mode; | 36 | int mode; |
19 | if (stat(s, &statbuf) < 0) return (0); | 37 | if (stat(s, &statbuf) < 0) return (0); |
@@ -22,13 +40,14 @@ int sys_isreadablefile(const char *s) | |||
22 | if (S_ISDIR(mode)) return (0); | 40 | if (S_ISDIR(mode)) return (0); |
23 | #endif | 41 | #endif |
24 | return (1); | 42 | return (1); |
43 | #endif /* ROCKBOX */ | ||
25 | } | 44 | } |
26 | 45 | ||
27 | /* change '/' characters to the system's native file separator */ | 46 | /* change '/' characters to the system's native file separator */ |
28 | void sys_bashfilename(const char *from, char *to) | 47 | void sys_bashfilename(const char *from, char *to) |
29 | { | 48 | { |
30 | char c; | 49 | char c; |
31 | while (c = *from++) | 50 | while((c = *from++)) |
32 | { | 51 | { |
33 | #ifdef MSW | 52 | #ifdef MSW |
34 | if (c == '/') c = '\\'; | 53 | if (c == '/') c = '\\'; |
@@ -43,7 +62,7 @@ void sys_bashfilename(const char *from, char *to) | |||
43 | void sys_unbashfilename(const char *from, char *to) | 62 | void sys_unbashfilename(const char *from, char *to) |
44 | { | 63 | { |
45 | char c; | 64 | char c; |
46 | while (c = *from++) | 65 | while((c = *from++)) |
47 | { | 66 | { |
48 | #ifdef MSW | 67 | #ifdef MSW |
49 | if (c == '\\') c = '/'; | 68 | if (c == '\\') c = '/'; |