Changeset 5303
Remove config_text_file_save, it is unused
Comitted by:
mjagdis
Date:
Jan 07 2009 * 18:27 (over 3 years ago)
Affected files:
callweaver/trunk/corelib/config.c (unified diff)
| r5294 | r5303 | |
|---|---|---|
| 708 | 708 | return cfg; |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | int config_text_file_save(const char *configfile, const struct cw_config *cfg, const char *generator) | |
| 712 | { | |
| 713 | FILE *f; | |
| 714 | char fn[256]; | |
| 715 | char date[256]=""; | |
| 716 | time_t t; | |
| 717 | struct cw_variable *var; | |
| 718 | struct cw_category *cat; | |
| 719 | int blanklines = 0; | |
| 720 | ||
| 721 | if (configfile[0] == '/') { | |
| 722 | cw_copy_string(fn, configfile, sizeof(fn)); | |
| 723 | } else { | |
| 724 | snprintf(fn, sizeof(fn), "%s/%s", cw_config_CW_CONFIG_DIR, configfile); | |
| 725 | } | |
| 726 | time(&t); | |
| 727 | cw_copy_string(date, ctime(&t), sizeof(date)); | |
| 728 | #if defined(__CYGWIN__) | |
| 729 | if ((f = fopen(fn, "w+"))) { | |
| 730 | #else | |
| 731 | if ((f = fopen(fn, "w"))) { | |
| 732 | #endif | |
| 733 | if ((option_verbose > 1) && !option_debug) | |
| 734 | cw_verbose( VERBOSE_PREFIX_2 "Saving '%s': ", fn); | |
| 735 | fprintf(f, ";!\n"); | |
| 736 | fprintf(f, ";! Automatically generated configuration file\n"); | |
| 737 | fprintf(f, ";! Filename: %s (%s)\n", configfile, fn); | |
| 738 | fprintf(f, ";! Generator: %s\n", generator); | |
| 739 | fprintf(f, ";! Creation Date: %s", date); | |
| 740 | fprintf(f, ";!\n"); | |
| 741 | cat = cfg->root; | |
| 742 | while(cat) { | |
| 743 | /* Dump section with any appropriate comment */ | |
| 744 | fprintf(f, "[%s]\n", cat->name); | |
| 745 | var = cat->root; | |
| 746 | while(var) { | |
| 747 | if (var->sameline) | |
| 748 | fprintf(f, "%s %s %s ; %s\n", var->name, (var->object ? "=>" : "="), var->value, var->sameline->cmt); | |
| 749 | else | |
| 750 | fprintf(f, "%s %s %s\n", var->name, (var->object ? "=>" : "="), var->value); | |
| 751 | if (var->blanklines) { | |
| 752 | blanklines = var->blanklines; | |
| 753 | while (blanklines--) | |
| 754 | fprintf(f, "\n"); | |
| 755 | } | |
| 756 | ||
| 757 | var = var->next; | |
| 758 | } | |
| 759 | #if 0 | |
| 760 | /* Put an empty line */ | |
| 761 | fprintf(f, "\n"); | |
| 762 | #endif | |
| 763 | cat = cat->next; | |
| 764 | } | |
| 765 | fclose(f); | |
| 766 | } else { | |
| 767 | cw_log(CW_LOG_ERROR, "Unable to write '%s': %s\n", fn, strerror(errno)); | |
| 768 | return -1; | |
| 769 | } | |
| 770 | return 0; | |
| 771 | } | |
| 772 | ||
| 773 | 711 | static void clear_config_maps(void) |
| 774 | 712 | { |
| 775 | 713 | struct cw_config_map *map; |
callweaver/trunk/include/callweaver/config.h (unified diff)
| r5298 | r5303 | |
|---|---|---|
| 214 | 214 | extern CW_API_PUBLIC void cw_variable_append(struct cw_category *category, struct cw_variable *variable); |
| 215 | 215 | extern CW_API_PUBLIC int cw_variable_delete(struct cw_config *cfg, char *category, char *variable, char *value); |
| 216 | 216 | |
| 217 | extern CW_API_PUBLIC int config_text_file_save(const char *filename, const struct cw_config *cfg, const char *generator); | |
| 218 | ||
| 219 | 217 | extern CW_API_PUBLIC struct cw_config *cw_config_internal_load(const char *configfile, struct cw_config *cfg); |
| 220 | 218 | |
| 221 | 219 | #if defined(__cplusplus) || defined(c_plusplus) |
![Home changeset 5303 [home]](/images/logo.png?1180520111)

RSS Feeds