From 690bcfada2249730bdb6fa9890ad707c4c8d4e3f Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Tue, 25 Jan 2005 06:11:11 +0000 Subject: [PATCH] Add old config files (bug #3406) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4890 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- config_old.c | 67 +++++++++++++++++++++++++++++++++++ include/asterisk/config_old.h | 42 ++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100755 config_old.c create mode 100755 include/asterisk/config_old.h diff --git a/config_old.c b/config_old.c new file mode 100755 index 0000000000..9b922025ce --- /dev/null +++ b/config_old.c @@ -0,0 +1,67 @@ +/* + * Asterisk -- A telephony toolkit for Linux. + * + * Configuration File Parser (Deprecated APIs) + * + * Copyright (C) 2005, Digium, Inc. + * + * Mark Spencer + * + * This program is free software, distributed under the terms of + * the GNU General Public License + */ + +#include +#include +#include +#include +#include +#include +#include + +struct ast_config *ast_load(char *configfile) +{ + static int warning = 0; + + if (!warning) { + ast_log(LOG_WARNING, "ast_load is deprecated, use ast_config_load instead!\n"); + warning = 1; + } + + return ast_config_load(configfile); +} + +void ast_destroy(struct ast_config *config) +{ + static int warning = 0; + + if (!warning) { + ast_log(LOG_WARNING, "ast_destroy is deprecated, use ast_config_destroy instead!\n"); + warning = 1; + } + ast_config_destroy(config); +} + +void ast_destroy_realtime(struct ast_variable *var) +{ + static int warning = 0; + + if (!warning) { + ast_log(LOG_WARNING, "ast_destroy_realtime is deprecated, use ast_variables_destroy instead!\n"); + warning = 1; + } + ast_variables_destroy(var); +} + +struct ast_config *ast_internal_load(const char *configfile, struct ast_config *cfg) +{ + static int warning = 0; + + if (!warning) { + ast_log(LOG_WARNING, "ast_internal_load is deprecated, use ast_config_internal_load instead!\n"); + warning = 1; + } + + return ast_internal_load(configfile, cfg); +} + diff --git a/include/asterisk/config_old.h b/include/asterisk/config_old.h new file mode 100755 index 0000000000..dcde09932c --- /dev/null +++ b/include/asterisk/config_old.h @@ -0,0 +1,42 @@ +/* + * Asterisk -- A telephony toolkit for Linux. + * + * Configuration File Parser (Deprecated APIs) + * + * Copyright (C) 1999-2005, Mark Spencer + * + * Mark Spencer + * + * This program is free software, distributed under the terms of + * the GNU General Public License + */ + +#ifndef _ASTERISK_CONFIG_OLD_H +#define _ASTERISK_CONFIG_OLD_H + +/*! Load a config file */ +/*! + * \param configfile path of file to open. If no preceding '/' character, path is considered relative to AST_CONFIG_DIR + * Create a config structure from a given configuration file. + * Returns NULL on error, or an ast_config data structure on success + */ +struct ast_config *ast_load(char *configfile); + +/*! Removes a config */ +/*! + * \param config config data structure associated with the config. + * Free memory associated with a given config + * Returns nothing + */ +void ast_destroy(struct ast_config *config); + +/*! Free variable list */ +/*! + * \param var the linked list of variables to free + * This function frees a list of variables. + */ +void ast_destroy_realtime(struct ast_variable *var); + +struct ast_config *ast_internal_load(const char *configfile, struct ast_config *cfg); + +#endif