Add old config files (bug #3406)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4890 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer 2005-01-25 06:11:11 +00:00
parent 5f726ad8c7
commit 690bcfada2
2 changed files with 109 additions and 0 deletions

67
config_old.c Executable file
View File

@ -0,0 +1,67 @@
/*
* Asterisk -- A telephony toolkit for Linux.
*
* Configuration File Parser (Deprecated APIs)
*
* Copyright (C) 2005, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <asterisk/config.h>
#include <asterisk/logger.h>
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);
}

42
include/asterisk/config_old.h Executable file
View File

@ -0,0 +1,42 @@
/*
* Asterisk -- A telephony toolkit for Linux.
*
* Configuration File Parser (Deprecated APIs)
*
* Copyright (C) 1999-2005, Mark Spencer
*
* Mark Spencer <markster@digium.com>
*
* 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