int fwfile_add_meta_conf(cfg_t *cfg, struct archive *a, const unsigned char *signing_key) { char *configtxt; size_t configtxt_len; cfg_to_string(cfg, &configtxt, &configtxt_len); int rc = fwfile_add_meta_conf_str(configtxt, configtxt_len, a, signing_key); free(configtxt); return rc; }
static bool settings_write_config(const char* filename, int options) { int i; int fd; char value[MAX_PATH]; fd = open(filename,O_CREAT|O_TRUNC|O_WRONLY, 0666); if (fd < 0) return false; fdprintf(fd, "# .cfg file created by rockbox %s - " "http://www.rockbox.org\r\n\r\n", rbversion); for(i=0; i<nb_settings; i++) { if (settings[i].cfg_name == NULL) continue; value[0] = '\0'; if (settings[i].flags & F_DEPRECATED) continue; switch (options) { case SETTINGS_SAVE_CHANGED: if (!is_changed(i)) continue; break; case SETTINGS_SAVE_SOUND: if ((settings[i].flags&F_SOUNDSETTING) == 0) continue; break; case SETTINGS_SAVE_THEME: if ((settings[i].flags&F_THEMESETTING) == 0) continue; break; #ifdef HAVE_RECORDING case SETTINGS_SAVE_RECPRESETS: if ((settings[i].flags&F_RECSETTING) == 0) continue; break; #endif #if CONFIG_CODEC == SWCODEC case SETTINGS_SAVE_EQPRESET: if ((settings[i].flags&F_EQSETTING) == 0) continue; break; #endif } cfg_to_string(i, value, MAX_PATH); fdprintf(fd,"%s: %s\r\n",settings[i].cfg_name,value); } /* for(...) */ close(fd); return true; }