summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/lib/configfile.c20
-rw-r--r--apps/plugins/lib/configfile.h4
2 files changed, 12 insertions, 12 deletions
diff --git a/apps/plugins/lib/configfile.c b/apps/plugins/lib/configfile.c
index ab1e21ad4a..2ab8f77e26 100644
--- a/apps/plugins/lib/configfile.c
+++ b/apps/plugins/lib/configfile.c
@@ -42,7 +42,7 @@ static void get_cfg_filename(char* buf, int buf_len, const char* filename)
42#endif 42#endif
43} 43}
44 44
45int configfile_save(const char *filename, struct configdata *cfg, 45int configfile_save(const char *filename, const struct configdata *cfg,
46 int num_items, int version) 46 int num_items, int version)
47{ 47{
48 int fd; 48 int fd;
@@ -56,7 +56,7 @@ int configfile_save(const char *filename, struct configdata *cfg,
56 56
57 /* pre-allocate 10 bytes for INT */ 57 /* pre-allocate 10 bytes for INT */
58 rb->fdprintf(fd, "file version: %10d\n", version); 58 rb->fdprintf(fd, "file version: %10d\n", version);
59 59
60 for(i = 0;i < num_items;i++) { 60 for(i = 0;i < num_items;i++) {
61 switch(cfg[i].type) { 61 switch(cfg[i].type) {
62 case TYPE_INT: 62 case TYPE_INT:
@@ -91,7 +91,7 @@ int configfile_save(const char *filename, struct configdata *cfg,
91 return 0; 91 return 0;
92} 92}
93 93
94int configfile_load(const char *filename, struct configdata *cfg, 94int configfile_load(const char *filename, const struct configdata *cfg,
95 int num_items, int min_version) 95 int num_items, int min_version)
96{ 96{
97 int fd; 97 int fd;
@@ -118,7 +118,7 @@ int configfile_load(const char *filename, struct configdata *cfg,
118 return -1; 118 return -1;
119 } 119 }
120 } 120 }
121 121
122 for(i = 0;i < num_items;i++) { 122 for(i = 0;i < num_items;i++) {
123 if(!rb->strcmp(cfg[i].name, name)) { 123 if(!rb->strcmp(cfg[i].name, name)) {
124 switch(cfg[i].type) { 124 switch(cfg[i].type) {
@@ -149,7 +149,7 @@ int configfile_load(const char *filename, struct configdata *cfg,
149 } 149 }
150 } 150 }
151 } 151 }
152 152
153 rb->close(fd); 153 rb->close(fd);
154 return 0; 154 return 0;
155} 155}
@@ -190,13 +190,13 @@ int configfile_update_entry(const char* filename, const char* name, int val)
190 int found = 0; 190 int found = 0;
191 int line_len = 0; 191 int line_len = 0;
192 int pos = 0; 192 int pos = 0;
193 193
194 /* open the current config file */ 194 /* open the current config file */
195 get_cfg_filename(path, MAX_PATH, filename); 195 get_cfg_filename(path, MAX_PATH, filename);
196 fd = rb->open(path, O_RDWR); 196 fd = rb->open(path, O_RDWR);
197 if(fd < 0) 197 if(fd < 0)
198 return -1; 198 return -1;
199 199
200 /* read in the current stored settings */ 200 /* read in the current stored settings */
201 while((line_len = rb->read_line(fd, buf, 256)) > 0) 201 while((line_len = rb->read_line(fd, buf, 256)) > 0)
202 { 202 {
@@ -211,13 +211,13 @@ int configfile_update_entry(const char* filename, const char* name, int val)
211 } 211 }
212 pos += line_len; 212 pos += line_len;
213 } 213 }
214 214
215 /* if (name/val) is a new entry just append to file */ 215 /* if (name/val) is a new entry just append to file */
216 if (found == 0) 216 if (found == 0)
217 /* pre-allocate 10 bytes for INT */ 217 /* pre-allocate 10 bytes for INT */
218 rb->fdprintf(fd, "%s: %10d\n", name, val); 218 rb->fdprintf(fd, "%s: %10d\n", name, val);
219 219
220 rb->close(fd); 220 rb->close(fd);
221 221
222 return found; 222 return found;
223} 223}
diff --git a/apps/plugins/lib/configfile.h b/apps/plugins/lib/configfile.h
index 4a980b4e67..69869142e2 100644
--- a/apps/plugins/lib/configfile.h
+++ b/apps/plugins/lib/configfile.h
@@ -45,10 +45,10 @@ struct configdata
45/* configfile_save - Given configdata entries this function will 45/* configfile_save - Given configdata entries this function will
46 create a config file with these entries, destroying any 46 create a config file with these entries, destroying any
47 previous config file of the same name */ 47 previous config file of the same name */
48int configfile_save(const char *filename, struct configdata *cfg, 48int configfile_save(const char *filename, const struct configdata *cfg,
49 int num_items, int version); 49 int num_items, int version);
50 50
51int configfile_load(const char *filename, struct configdata *cfg, 51int configfile_load(const char *filename, const struct configdata *cfg,
52 int num_items, int min_version); 52 int num_items, int min_version);
53 53
54/* configfile_get_value - Given a key name, this function will 54/* configfile_get_value - Given a key name, this function will