Commit 2d9c9ee6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Split the big config file

parent 74710712
......@@ -299,9 +299,11 @@ SOURCES_libvlc_common = \
misc/threads.c \
misc/stats.c \
misc/cpu.c \
modules/configuration.h \
modules/configuration.c \
modules/configuration_chain.c \
config/configuration.h \
config/core.c \
config/chain.c \
config/file.c \
config/cmdline.c \
misc/events.c \
misc/image.c \
misc/messages.c \
......
/*****************************************************************************
* configuration_chain.c : configuration module chain parsing stuff
* chain.c : configuration module chain parsing stuff
*****************************************************************************
* Copyright (C) 2002-2006 the VideoLAN team
* Copyright (C) 2002-2007 the VideoLAN team
* $Id$
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
......
This diff is collapsed.
......@@ -53,6 +53,8 @@ int __config_LoadConfigFile( vlc_object_t *, const char * );
int IsConfigStringType( int type );
int ConfigStringToKey( const char * );
/* The configuration file and directory */
#if defined (SYS_BEOS)
# define CONFIG_DIR "config/settings/VideoLAN Client"
......
This diff is collapsed.
/*****************************************************************************
* intf.c: interface configuration handling
*****************************************************************************
* Copyright (C) 2001-2007 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <vlc/vlc.h>
#include "../libvlc.h"
#include "vlc_keys.h"
#include "vlc_charset.h"
#include <errno.h> /* errno */
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h> /* getuid() */
#endif
#ifdef HAVE_GETOPT_LONG
# ifdef HAVE_GETOPT_H
# include <getopt.h> /* getopt() */
# endif
#else
# include "../extras/getopt.h"
#endif
#if defined(HAVE_GETPWUID)
# include <pwd.h> /* getpwuid() */
#endif
#if defined( HAVE_SYS_STAT_H )
# include <sys/stat.h>
#endif
#if defined( HAVE_SYS_TYPES_H )
# include <sys/types.h>
#endif
#if defined( WIN32 )
# if !defined( UNDER_CE )
# include <direct.h>
# endif
#include <tchar.h>
#endif
#include "configuration.h"
#include "modules/modules.h"
/* Adds an extra interface to the configuration */
void __config_AddIntf( vlc_object_t *p_this, const char *psz_intf )
{
assert( psz_intf );
char *psz_config, *psz_parser;
size_t i_len = strlen( psz_intf );
psz_config = psz_parser = config_GetPsz( p_this->p_libvlc, "control" );
while( psz_parser )
{
if( !strncmp( psz_intf, psz_parser, i_len ) )
{
free( psz_config );
return;
}
psz_parser = strchr( psz_parser, ':' );
if( psz_parser ) psz_parser++; /* skip the ':' */
}
free( psz_config );
psz_config = psz_parser = config_GetPsz( p_this->p_libvlc, "extraintf" );
while( psz_parser )
{
if( !strncmp( psz_intf, psz_parser, i_len ) )
{
free( psz_config );
return;
}
psz_parser = strchr( psz_parser, ':' );
if( psz_parser ) psz_parser++; /* skip the ':' */
}
/* interface not found in the config, let's add it */
if( psz_config && strlen( psz_config ) > 0 )
{
char *psz_newconfig;
if( asprintf( &psz_newconfig, "%s:%s", psz_config, psz_intf ) != -1 )
{
config_PutPsz( p_this->p_libvlc, "extraintf", psz_newconfig );
free( psz_newconfig );
}
}
else
config_PutPsz( p_this->p_libvlc, "extraintf", psz_intf );
free( psz_config );
}
/* Removes an extra interface from the configuration */
void __config_RemoveIntf( vlc_object_t *p_this, const char *psz_intf )
{
assert( psz_intf );
char *psz_config, *psz_parser;
size_t i_len = strlen( psz_intf );
psz_config = psz_parser = config_GetPsz( p_this->p_libvlc, "extraintf" );
while( psz_parser )
{
if( !strncmp( psz_intf, psz_parser, i_len ) )
{
char *psz_newconfig;
char *psz_end = psz_parser + i_len;
if( *psz_end == ':' ) psz_end++;
*psz_parser = '\0';
if( asprintf( &psz_newconfig, "%s%s", psz_config, psz_end ) != -1 )
{
config_PutPsz( p_this->p_libvlc, "extraintf", psz_newconfig );
free( psz_newconfig );
}
break;
}
psz_parser = strchr( psz_parser, ':' );
if( psz_parser ) psz_parser++; /* skip the ':' */
}
free( psz_config );
psz_config = psz_parser = config_GetPsz( p_this->p_libvlc, "control" );
while( psz_parser )
{
if( !strncmp( psz_intf, psz_parser, i_len ) )
{
char *psz_newconfig;
char *psz_end = psz_parser + i_len;
if( *psz_end == ':' ) psz_end++;
*psz_parser = '\0';
if( asprintf( &psz_newconfig, "%s%s", psz_config, psz_end ) != -1 )
{
config_PutPsz( p_this->p_libvlc, "control", psz_newconfig );
free( psz_newconfig );
}
break;
}
psz_parser = strchr( psz_parser, ':' );
if( psz_parser ) psz_parser++; /* skip the ':' */
}
free( psz_config );
}
/*
* Returns VLC_TRUE if the specified extra interface is present in the
* configuration, VLC_FALSE if not
*/
vlc_bool_t __config_ExistIntf( vlc_object_t *p_this, const char *psz_intf )
{
assert( psz_intf );
char *psz_config, *psz_parser;
size_t i_len = strlen( psz_intf );
psz_config = psz_parser = config_GetPsz( p_this->p_libvlc, "extraintf" );
while( psz_parser )
{
if( !strncmp( psz_parser, psz_intf, i_len ) )
{
free( psz_config );
return VLC_TRUE;
}
psz_parser = strchr( psz_parser, ':' );
if( psz_parser ) psz_parser++; /* skip the ':' */
}
free( psz_config );
psz_config = psz_parser = config_GetPsz( p_this->p_libvlc, "control" );
while( psz_parser )
{
if( !strncmp( psz_parser, psz_intf, i_len ) )
{
free( psz_config );
return VLC_TRUE;
}
psz_parser = strchr( psz_parser, ':' );
if( psz_parser ) psz_parser++; /* skip the ':' */
}
free( psz_config );
return VLC_FALSE;
}
......@@ -37,7 +37,7 @@
#include <vlc_input.h>
#include "modules/modules.h"
#include "modules/configuration.h"
#include "config/config.h"
#include <errno.h> /* ENOMEM */
#include <stdio.h> /* sprintf() */
......
......@@ -76,7 +76,7 @@
# endif
#endif
#include "modules/configuration.h"
#include "config/config.h"
#include "libvlc.h"
#include "vlc_charset.h"
......
......@@ -24,7 +24,7 @@
#include <vlc_playlist.h>
#include <vlc_events.h>
#include "playlist_internal.h"
#include "modules/configuration.h"
#include "config/config.h"
#include <vlc_charset.h>
#include <sys/types.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment