diff options
author | Daniel Stenberg <daniel@haxx.se> | 2003-03-05 22:59:36 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2003-03-05 22:59:36 +0000 |
commit | 11d9ecbc108912b20da2e9a1c2028a8d7584b114 (patch) | |
tree | 21d40a0f694d8da8832d041ce9f6a63849dcb404 /uisimulator/x11/io.c | |
parent | 52eccba052472b4b793584706e05b76ed435f446 (diff) | |
download | rockbox-11d9ecbc108912b20da2e9a1c2028a8d7584b114.tar.gz rockbox-11d9ecbc108912b20da2e9a1c2028a8d7584b114.zip |
killed a warning
properly indented some code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3389 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/x11/io.c')
-rw-r--r-- | uisimulator/x11/io.c | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/uisimulator/x11/io.c b/uisimulator/x11/io.c index 9a3030ba35..bc9c99fa10 100644 --- a/uisimulator/x11/io.c +++ b/uisimulator/x11/io.c | |||
@@ -36,124 +36,124 @@ | |||
36 | #define SIMULATOR_ARCHOS_ROOT "archos" | 36 | #define SIMULATOR_ARCHOS_ROOT "archos" |
37 | 37 | ||
38 | struct mydir { | 38 | struct mydir { |
39 | DIR *dir; | 39 | DIR *dir; |
40 | char *name; | 40 | char *name; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | typedef struct mydir MYDIR; | 43 | typedef struct mydir MYDIR; |
44 | 44 | ||
45 | MYDIR *x11_opendir(char *name) | 45 | MYDIR *x11_opendir(char *name) |
46 | { | 46 | { |
47 | char buffer[256]; /* sufficiently big */ | 47 | char buffer[256]; /* sufficiently big */ |
48 | DIR *dir; | 48 | DIR *dir; |
49 | 49 | ||
50 | if(name[0] == '/') { | 50 | if(name[0] == '/') { |
51 | sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); | 51 | sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); |
52 | dir=(DIR *)opendir(buffer); | 52 | dir=(DIR *)opendir(buffer); |
53 | } | 53 | } |
54 | else | 54 | else |
55 | dir=(DIR *)opendir(name); | 55 | dir=(DIR *)opendir(name); |
56 | 56 | ||
57 | if(dir) { | 57 | if(dir) { |
58 | MYDIR *my = (MYDIR *)malloc(sizeof(MYDIR)); | 58 | MYDIR *my = (MYDIR *)malloc(sizeof(MYDIR)); |
59 | my->dir = dir; | 59 | my->dir = dir; |
60 | my->name = (char *)strdup(name); | 60 | my->name = (char *)strdup(name); |
61 | 61 | ||
62 | return my; | 62 | return my; |
63 | } | 63 | } |
64 | /* failed open, return NULL */ | 64 | /* failed open, return NULL */ |
65 | return (MYDIR *)0; | 65 | return (MYDIR *)0; |
66 | } | 66 | } |
67 | 67 | ||
68 | struct x11_dirent *x11_readdir(MYDIR *dir) | 68 | struct x11_dirent *x11_readdir(MYDIR *dir) |
69 | { | 69 | { |
70 | char buffer[512]; /* sufficiently big */ | 70 | char buffer[512]; /* sufficiently big */ |
71 | static struct x11_dirent secret; | 71 | static struct x11_dirent secret; |
72 | struct stat s; | 72 | struct stat s; |
73 | struct dirent *x11 = (readdir)(dir->dir); | 73 | struct dirent *x11 = (readdir)(dir->dir); |
74 | 74 | ||
75 | if(!x11) | 75 | if(!x11) |
76 | return (struct x11_dirent *)0; | 76 | return (struct x11_dirent *)0; |
77 | 77 | ||
78 | strcpy(secret.d_name, x11->d_name); | 78 | strcpy(secret.d_name, x11->d_name); |
79 | 79 | ||
80 | /* build file name */ | 80 | /* build file name */ |
81 | sprintf(buffer, SIMULATOR_ARCHOS_ROOT "%s/%s", | 81 | sprintf(buffer, SIMULATOR_ARCHOS_ROOT "%s/%s", |
82 | dir->name, x11->d_name); | 82 | dir->name, x11->d_name); |
83 | stat(buffer, &s); /* get info */ | 83 | stat(buffer, &s); /* get info */ |
84 | 84 | ||
85 | secret.attribute = S_ISDIR(s.st_mode)?ATTR_DIRECTORY:0; | 85 | secret.attribute = S_ISDIR(s.st_mode)?ATTR_DIRECTORY:0; |
86 | secret.size = s.st_size; | 86 | secret.size = s.st_size; |
87 | 87 | ||
88 | return &secret; | 88 | return &secret; |
89 | } | 89 | } |
90 | 90 | ||
91 | void x11_closedir(MYDIR *dir) | 91 | void x11_closedir(MYDIR *dir) |
92 | { | 92 | { |
93 | free(dir->name); | 93 | free(dir->name); |
94 | (closedir)(dir->dir); | 94 | (closedir)(dir->dir); |
95 | 95 | ||
96 | free(dir); | 96 | free(dir); |
97 | } | 97 | } |
98 | 98 | ||
99 | 99 | ||
100 | int x11_open(char *name, int opts) | 100 | int x11_open(char *name, int opts) |
101 | { | 101 | { |
102 | char buffer[256]; /* sufficiently big */ | 102 | char buffer[256]; /* sufficiently big */ |
103 | 103 | ||
104 | if(name[0] == '/') { | 104 | if(name[0] == '/') { |
105 | sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); | 105 | sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); |
106 | 106 | ||
107 | debugf("We open the real file '%s'\n", buffer); | 107 | debugf("We open the real file '%s'\n", buffer); |
108 | return (open)(buffer, opts); | 108 | return (open)(buffer, opts); |
109 | } | 109 | } |
110 | return (open)(name, opts); | 110 | return (open)(name, opts); |
111 | } | 111 | } |
112 | 112 | ||
113 | int x11_close(int fd) | 113 | int x11_close(int fd) |
114 | { | 114 | { |
115 | return (close)(fd); | 115 | return (close)(fd); |
116 | } | 116 | } |
117 | 117 | ||
118 | int x11_creat(char *name, int mode) | 118 | int x11_creat(char *name, int mode) |
119 | { | 119 | { |
120 | char buffer[256]; /* sufficiently big */ | 120 | char buffer[256]; /* sufficiently big */ |
121 | 121 | (void)mode; | |
122 | if(name[0] == '/') { | 122 | if(name[0] == '/') { |
123 | sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); | 123 | sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); |
124 | 124 | ||
125 | debugf("We create the real file '%s'\n", buffer); | 125 | debugf("We create the real file '%s'\n", buffer); |
126 | return (creat)(buffer, 0666); | 126 | return (creat)(buffer, 0666); |
127 | } | 127 | } |
128 | return (creat)(name, 0666); | 128 | return (creat)(name, 0666); |
129 | } | 129 | } |
130 | 130 | ||
131 | int x11_remove(char *name) | 131 | int x11_remove(char *name) |
132 | { | 132 | { |
133 | char buffer[256]; /* sufficiently big */ | 133 | char buffer[256]; /* sufficiently big */ |
134 | 134 | ||
135 | if(name[0] == '/') { | 135 | if(name[0] == '/') { |
136 | sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); | 136 | sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); |
137 | 137 | ||
138 | debugf("We remove the real file '%s'\n", buffer); | 138 | debugf("We remove the real file '%s'\n", buffer); |
139 | return (remove)(buffer); | 139 | return (remove)(buffer); |
140 | } | 140 | } |
141 | return (remove)(name); | 141 | return (remove)(name); |
142 | } | 142 | } |
143 | 143 | ||
144 | int x11_rename(char *oldpath, char* newpath) | 144 | int x11_rename(char *oldpath, char* newpath) |
145 | { | 145 | { |
146 | char buffer1[256]; | 146 | char buffer1[256]; |
147 | char buffer2[256]; | 147 | char buffer2[256]; |
148 | 148 | ||
149 | if(oldpath[0] == '/') { | 149 | if(oldpath[0] == '/') { |
150 | sprintf(buffer1, "%s%s", SIMULATOR_ARCHOS_ROOT, oldpath); | 150 | sprintf(buffer1, "%s%s", SIMULATOR_ARCHOS_ROOT, oldpath); |
151 | sprintf(buffer2, "%s%s", SIMULATOR_ARCHOS_ROOT, newpath); | 151 | sprintf(buffer2, "%s%s", SIMULATOR_ARCHOS_ROOT, newpath); |
152 | 152 | ||
153 | debugf("We rename the real file '%s' to '%s'\n", buffer1, buffer2); | 153 | debugf("We rename the real file '%s' to '%s'\n", buffer1, buffer2); |
154 | return (rename)(buffer1, buffer2); | 154 | return (rename)(buffer1, buffer2); |
155 | } | 155 | } |
156 | return -1; | 156 | return -1; |
157 | } | 157 | } |
158 | 158 | ||
159 | void fat_size(unsigned int* size, unsigned int* free) | 159 | void fat_size(unsigned int* size, unsigned int* free) |