1 /*****************************************************************************
2 * core.c management of the modules configuration
3 *****************************************************************************
4 * Copyright (C) 2001-2007 the VideoLAN team
7 * Authors: Gildas Bazin <gbazin@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
29 #include "../libvlc.h"
31 #include "vlc_charset.h"
33 #include <errno.h> /* errno */
38 # include <unistd.h> /* getuid() */
41 #ifdef HAVE_GETOPT_LONG
43 # include <getopt.h> /* getopt() */
46 # include "../extras/getopt.h"
49 #if defined(HAVE_GETPWUID)
50 # include <pwd.h> /* getpwuid() */
53 #if defined( HAVE_SYS_STAT_H )
54 # include <sys/stat.h>
56 #if defined( HAVE_SYS_TYPES_H )
57 # include <sys/types.h>
60 # if !defined( UNDER_CE )
66 #include "configuration.h"
67 #include "modules/modules.h"
69 static inline char *strdupnull (const char *src)
71 return src ? strdup (src) : NULL;
74 static inline char *_strdupnull (const char *src)
76 return src ? strdup (_(src)) : NULL;
79 /* Item types that use a string value (i.e. serialized in the module cache) */
80 int IsConfigStringType (int type)
82 static const unsigned char config_types[] =
84 CONFIG_ITEM_STRING, CONFIG_ITEM_FILE, CONFIG_ITEM_MODULE,
85 CONFIG_ITEM_DIRECTORY, CONFIG_ITEM_MODULE_CAT, CONFIG_ITEM_PASSWORD,
86 CONFIG_ITEM_MODULE_LIST, CONFIG_ITEM_MODULE_LIST_CAT
89 /* NOTE: this needs to be changed if we ever get more than 255 types */
90 return memchr (config_types, type, sizeof (config_types)) != NULL;
94 int IsConfigIntegerType (int type)
96 static const unsigned char config_types[] =
98 CONFIG_ITEM_INTEGER, CONFIG_ITEM_KEY, CONFIG_ITEM_BOOL,
99 CONFIG_CATEGORY, CONFIG_SUBCATEGORY
102 return memchr (config_types, type, sizeof (config_types)) != NULL;
106 /*****************************************************************************
107 * config_GetType: get the type of a variable (bool, int, float, string)
108 *****************************************************************************
109 * This function is used to get the type of a variable from its name.
110 * Beware, this is quite slow.
111 *****************************************************************************/
112 int __config_GetType( vlc_object_t *p_this, const char *psz_name )
114 module_config_t *p_config;
117 p_config = config_FindConfig( p_this, psz_name );
125 switch( p_config->i_type )
127 case CONFIG_ITEM_BOOL:
128 i_type = VLC_VAR_BOOL;
131 case CONFIG_ITEM_INTEGER:
132 case CONFIG_ITEM_KEY:
133 i_type = VLC_VAR_INTEGER;
136 case CONFIG_ITEM_FLOAT:
137 i_type = VLC_VAR_FLOAT;
140 case CONFIG_ITEM_MODULE:
141 case CONFIG_ITEM_MODULE_CAT:
142 case CONFIG_ITEM_MODULE_LIST:
143 case CONFIG_ITEM_MODULE_LIST_CAT:
144 i_type = VLC_VAR_MODULE;
147 case CONFIG_ITEM_STRING:
148 i_type = VLC_VAR_STRING;
151 case CONFIG_ITEM_PASSWORD:
152 i_type = VLC_VAR_STRING;
155 case CONFIG_ITEM_FILE:
156 i_type = VLC_VAR_FILE;
159 case CONFIG_ITEM_DIRECTORY:
160 i_type = VLC_VAR_DIRECTORY;
171 /*****************************************************************************
172 * config_GetInt: get the value of an int variable
173 *****************************************************************************
174 * This function is used to get the value of variables which are internally
175 * represented by an integer (CONFIG_ITEM_INTEGER and
177 *****************************************************************************/
178 int __config_GetInt( vlc_object_t *p_this, const char *psz_name )
180 module_config_t *p_config;
182 p_config = config_FindConfig( p_this, psz_name );
187 msg_Err( p_this, "option %s does not exist", psz_name );
191 if (!IsConfigIntegerType (p_config->i_type))
193 msg_Err( p_this, "option %s does not refer to an int", psz_name );
197 return p_config->value.i;
200 /*****************************************************************************
201 * config_GetFloat: get the value of a float variable
202 *****************************************************************************
203 * This function is used to get the value of variables which are internally
204 * represented by a float (CONFIG_ITEM_FLOAT).
205 *****************************************************************************/
206 float __config_GetFloat( vlc_object_t *p_this, const char *psz_name )
208 module_config_t *p_config;
210 p_config = config_FindConfig( p_this, psz_name );
215 msg_Err( p_this, "option %s does not exist", psz_name );
219 if (!IsConfigFloatType (p_config->i_type))
221 msg_Err( p_this, "option %s does not refer to a float", psz_name );
225 return p_config->value.f;
228 /*****************************************************************************
229 * config_GetPsz: get the string value of a string variable
230 *****************************************************************************
231 * This function is used to get the value of variables which are internally
232 * represented by a string (CONFIG_ITEM_STRING, CONFIG_ITEM_FILE,
233 * CONFIG_ITEM_DIRECTORY, CONFIG_ITEM_PASSWORD, and CONFIG_ITEM_MODULE).
235 * Important note: remember to free() the returned char* because it's a
236 * duplicate of the actual value. It isn't safe to return a pointer to the
237 * actual value as it can be modified at any time.
238 *****************************************************************************/
239 char * __config_GetPsz( vlc_object_t *p_this, const char *psz_name )
241 module_config_t *p_config;
243 p_config = config_FindConfig( p_this, psz_name );
248 msg_Err( p_this, "option %s does not exist", psz_name );
252 if (!IsConfigStringType (p_config->i_type))
254 msg_Err( p_this, "option %s does not refer to a string", psz_name );
258 /* return a copy of the string */
259 vlc_mutex_lock( p_config->p_lock );
260 char *psz_value = strdupnull (p_config->value.psz);
261 vlc_mutex_unlock( p_config->p_lock );
266 /*****************************************************************************
267 * config_PutPsz: set the string value of a string variable
268 *****************************************************************************
269 * This function is used to set the value of variables which are internally
270 * represented by a string (CONFIG_ITEM_STRING, CONFIG_ITEM_FILE,
271 * CONFIG_ITEM_DIRECTORY, CONFIG_ITEM_PASSWORD, and CONFIG_ITEM_MODULE).
272 *****************************************************************************/
273 void __config_PutPsz( vlc_object_t *p_this,
274 const char *psz_name, const char *psz_value )
276 module_config_t *p_config;
277 vlc_value_t oldval, val;
279 p_config = config_FindConfig( p_this, psz_name );
285 msg_Warn( p_this, "option %s does not exist", psz_name );
289 if (!IsConfigStringType (p_config->i_type))
291 msg_Err( p_this, "option %s does not refer to a string", psz_name );
295 vlc_mutex_lock( p_config->p_lock );
297 /* backup old value */
298 oldval.psz_string = (char *)p_config->value.psz;
300 if ((psz_value != NULL) && *psz_value)
301 p_config->value.psz = strdup (psz_value);
303 p_config->value.psz = NULL;
305 p_config->b_dirty = VLC_TRUE;
307 val.psz_string = (char *)p_config->value.psz;
309 vlc_mutex_unlock( p_config->p_lock );
311 if( p_config->pf_callback )
313 p_config->pf_callback( p_this, psz_name, oldval, val,
314 p_config->p_callback_data );
317 /* free old string */
318 if( oldval.psz_string ) free( oldval.psz_string );
321 /*****************************************************************************
322 * config_PutInt: set the integer value of an int variable
323 *****************************************************************************
324 * This function is used to set the value of variables which are internally
325 * represented by an integer (CONFIG_ITEM_INTEGER and
327 *****************************************************************************/
328 void __config_PutInt( vlc_object_t *p_this, const char *psz_name, int i_value )
330 module_config_t *p_config;
331 vlc_value_t oldval, val;
333 p_config = config_FindConfig( p_this, psz_name );
338 msg_Warn( p_this, "option %s does not exist", psz_name );
342 if (!IsConfigIntegerType (p_config->i_type))
344 msg_Err( p_this, "option %s does not refer to an int", psz_name );
348 /* backup old value */
349 oldval.i_int = p_config->value.i;
351 /* if i_min == i_max == 0, then do not use them */
352 if ((p_config->min.i == 0) && (p_config->max.i == 0))
354 p_config->value.i = i_value;
356 else if (i_value < p_config->min.i)
358 p_config->value.i = p_config->min.i;
360 else if (i_value > p_config->max.i)
362 p_config->value.i = p_config->max.i;
366 p_config->value.i = i_value;
369 p_config->b_dirty = VLC_TRUE;
371 val.i_int = p_config->value.i;
373 if( p_config->pf_callback )
375 p_config->pf_callback( p_this, psz_name, oldval, val,
376 p_config->p_callback_data );
380 /*****************************************************************************
381 * config_PutFloat: set the value of a float variable
382 *****************************************************************************
383 * This function is used to set the value of variables which are internally
384 * represented by a float (CONFIG_ITEM_FLOAT).
385 *****************************************************************************/
386 void __config_PutFloat( vlc_object_t *p_this,
387 const char *psz_name, float f_value )
389 module_config_t *p_config;
390 vlc_value_t oldval, val;
392 p_config = config_FindConfig( p_this, psz_name );
397 msg_Warn( p_this, "option %s does not exist", psz_name );
401 if (!IsConfigFloatType (p_config->i_type))
403 msg_Err( p_this, "option %s does not refer to a float", psz_name );
407 /* backup old value */
408 oldval.f_float = p_config->value.f;
410 /* if f_min == f_max == 0, then do not use them */
411 if ((p_config->min.f == 0) && (p_config->max.f == 0))
413 p_config->value.f = f_value;
415 else if (f_value < p_config->min.f)
417 p_config->value.f = p_config->min.f;
419 else if (f_value > p_config->max.f)
421 p_config->value.f = p_config->max.f;
425 p_config->value.f = f_value;
428 p_config->b_dirty = VLC_TRUE;
430 val.f_float = p_config->value.f;
432 if( p_config->pf_callback )
434 p_config->pf_callback( p_this, psz_name, oldval, val,
435 p_config->p_callback_data );
439 /*****************************************************************************
440 * config_FindConfig: find the config structure associated with an option.
441 *****************************************************************************
442 * FIXME: This function really needs to be optimized.
443 * FIXME: And now even more.
444 *****************************************************************************/
445 module_config_t *config_FindConfig( vlc_object_t *p_this, const char *psz_name )
450 if( !psz_name ) return NULL;
452 p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
454 for( i_index = 0; i_index < p_list->i_count; i_index++ )
456 module_config_t *p_item, *p_end;
457 module_t *p_parser = (module_t *)p_list->p_values[i_index].p_object;
459 if( !p_parser->i_config_items )
462 for( p_item = p_parser->p_config, p_end = p_item + p_parser->confsize;
466 if( p_item->i_type & CONFIG_HINT )
469 if( !strcmp( psz_name, p_item->psz_name )
470 || ( p_item->psz_oldname
471 && !strcmp( psz_name, p_item->psz_oldname ) ) )
473 vlc_list_release( p_list );
479 vlc_list_release( p_list );
484 /*****************************************************************************
485 * config_Free: frees a duplicated module's configuration data.
486 *****************************************************************************
487 * This function frees all the data duplicated by config_Duplicate.
488 *****************************************************************************/
489 void config_Free( module_t *p_module )
493 for (size_t j = 0; j < p_module->confsize; j++)
495 module_config_t *p_item = p_module->p_config + j;
497 free( p_item->psz_type );
498 free( p_item->psz_name );
499 free( p_item->psz_text );
500 free( p_item->psz_longtext );
501 free( p_item->psz_oldname );
503 if (IsConfigStringType (p_item->i_type))
505 free (p_item->value.psz);
506 free (p_item->orig.psz);
507 free (p_item->saved.psz);
510 if( p_item->ppsz_list )
511 for( i = 0; i < p_item->i_list; i++ )
512 free( p_item->ppsz_list[i] );
513 if( p_item->ppsz_list_text )
514 for( i = 0; i < p_item->i_list; i++ )
515 free( p_item->ppsz_list_text[i] );
516 free( p_item->ppsz_list );
517 free( p_item->ppsz_list_text );
518 free( p_item->pi_list );
520 if( p_item->i_action )
522 for( i = 0; i < p_item->i_action; i++ )
524 free( p_item->ppsz_action_text[i] );
526 free( p_item->ppf_action );
527 free( p_item->ppsz_action_text );
531 free (p_module->p_config);
532 p_module->p_config = NULL;
535 /*****************************************************************************
536 * config_SetCallbacks: sets callback functions in the duplicate p_config.
537 *****************************************************************************
538 * Unfortunatly we cannot work directly with the module's config data as
539 * this module might be unloaded from memory at any time (remember HideModule).
540 * This is why we need to duplicate callbacks each time we reload the module.
541 *****************************************************************************/
542 void config_SetCallbacks( module_config_t *p_new, module_config_t *p_orig,
545 for (size_t i = 0; i < n; i++)
547 p_new->pf_callback = p_orig->pf_callback;
553 /*****************************************************************************
554 * config_UnsetCallbacks: unsets callback functions in the duplicate p_config.
555 *****************************************************************************
556 * We simply undo what we did in config_SetCallbacks.
557 *****************************************************************************/
558 void config_UnsetCallbacks( module_config_t *p_new, size_t n )
560 for (size_t i = 0; i < n; i++)
562 p_new->pf_callback = NULL;
567 /*****************************************************************************
568 * config_ResetAll: reset the configuration data for all the modules.
569 *****************************************************************************/
570 void __config_ResetAll( vlc_object_t *p_this )
576 /* Acquire config file lock */
577 vlc_mutex_lock( &p_this->p_libvlc->config_lock );
579 p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
581 for( i_index = 0; i_index < p_list->i_count; i_index++ )
583 p_module = (module_t *)p_list->p_values[i_index].p_object ;
584 if( p_module->b_submodule ) continue;
586 for (size_t i = 0; i < p_module->confsize; i++ )
588 if (IsConfigIntegerType (p_module->p_config[i].i_type))
589 p_module->p_config[i].value.i = p_module->p_config[i].orig.i;
591 if (IsConfigFloatType (p_module->p_config[i].i_type))
592 p_module->p_config[i].value.f = p_module->p_config[i].orig.f;
594 if (IsConfigStringType (p_module->p_config[i].i_type))
596 free ((char *)p_module->p_config[i].value.psz);
597 p_module->p_config[i].value.psz =
598 strdupnull (p_module->p_config[i].orig.psz);
603 vlc_list_release( p_list );
604 vlc_mutex_unlock( &p_this->p_libvlc->config_lock );
608 * config_GetDataDir: find directory where shared data is installed
610 * @return a string (always succeeds).
612 const char *config_GetDataDir( void )
614 #if defined (WIN32) || defined (UNDER_CE)
615 return vlc_global()->psz_vlcpath;
616 #elif defined(__APPLE__) || defined (SYS_BEOS)
617 static char path[PATH_MAX] = "";
621 snprintf( path, sizeof( path ), "%s/share",
622 vlc_global()->psz_vlcpath );
623 path[sizeof( path ) - 1] = '\0';
631 /*****************************************************************************
632 * config_GetHomeDir, config_GetUserDir: find the user's home directory.
633 *****************************************************************************
634 * This function will try by different ways to find the user's home path.
635 * Note that this function is not reentrant, it should be called only once
636 * at the beginning of main where the result will be stored for later use.
637 *****************************************************************************/
638 static char *GetDir( vlc_bool_t b_appdata )
640 const char *psz_localhome = NULL;
642 #if defined(WIN32) && !defined(UNDER_CE)
643 typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD,
645 #ifndef CSIDL_FLAG_CREATE
646 # define CSIDL_FLAG_CREATE 0x8000
648 #ifndef CSIDL_APPDATA
649 # define CSIDL_APPDATA 0x1A
651 #ifndef CSIDL_PROFILE
652 # define CSIDL_PROFILE 0x28
654 #ifndef SHGFP_TYPE_CURRENT
655 # define SHGFP_TYPE_CURRENT 0
658 HINSTANCE shfolder_dll;
659 SHGETFOLDERPATH SHGetFolderPath ;
661 /* load the shfolder dll to retrieve SHGetFolderPath */
662 if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL )
664 SHGetFolderPath = (void *)GetProcAddress( shfolder_dll,
665 _T("SHGetFolderPathW") );
666 if ( SHGetFolderPath != NULL )
668 wchar_t whomedir[MAX_PATH];
670 /* get the "Application Data" folder for the current user */
671 if( S_OK == SHGetFolderPath( NULL,
672 (b_appdata ? CSIDL_APPDATA :
673 CSIDL_PROFILE) | CSIDL_FLAG_CREATE,
674 NULL, SHGFP_TYPE_CURRENT,
677 FreeLibrary( shfolder_dll );
678 return FromWide( whomedir );
681 FreeLibrary( shfolder_dll );
684 #elif defined(UNDER_CE)
686 #ifndef CSIDL_APPDATA
687 # define CSIDL_APPDATA 0x1A
690 wchar_t whomedir[MAX_PATH];
692 /* get the "Application Data" folder for the current user */
693 if( SHGetSpecialFolderPath( NULL, whomedir, CSIDL_APPDATA, 1 ) )
694 return FromWide( whomedir );
697 psz_localhome = getenv( "HOME" );
698 if( psz_localhome == NULL )
700 #if defined(HAVE_GETPWUID)
704 if( ( p_pw = getpwuid( getuid() ) ) != NULL )
705 psz_localhome = p_pw->pw_dir;
709 psz_localhome = getenv( "TMP" );
710 if( psz_localhome == NULL )
711 psz_localhome = "/tmp";
715 return FromLocaleDup( psz_localhome );
719 * Get the user's home directory
721 char *config_GetHomeDir( void )
723 return GetDir( VLC_FALSE );
727 * Get the user's main data and config directory:
728 * - on windows that's the App Data directory;
729 * - on other OSes it's the same as the home directory.
731 char *config_GetUserDir( void )
733 return GetDir( VLC_TRUE );
737 * Get the user's VLC configuration directory
739 char *config_GetConfigDir( libvlc_int_t *p_libvlc )
742 #if defined(WIN32) || defined(__APPLE__) || defined(SYS_BEOS)
743 char *psz_parent = config_GetUserDir();
744 if( !psz_parent ) psz_parent = p_libvlc->psz_homedir;
745 if( asprintf( &psz_dir, "%s" DIR_SEP CONFIG_DIR, psz_parent ) == -1 )
749 /* XDG Base Directory Specification - Version 0.6 */
750 char *psz_env = getenv( "XDG_CONFIG_HOME" );
753 if( asprintf( &psz_dir, "%s/vlc", psz_env ) == -1 )
757 psz_env = getenv( "HOME" );
758 if( !psz_env ) psz_env = p_libvlc->psz_homedir; /* not part of XDG spec but we want a sensible fallback */
759 if( asprintf( &psz_dir, "%s/.config/vlc", psz_env ) == -1 )
766 * Get the user's VLC data directory
767 * (used for stuff like the skins, custom lua modules, ...)
769 char *config_GetUserDataDir( libvlc_int_t *p_libvlc )
772 #if defined(WIN32) || defined(__APPLE__) || defined(SYS_BEOS)
773 char *psz_parent = config_GetUserDir();
774 if( !psz_parent ) psz_parent = p_libvlc->psz_homedir;
775 if( asprintf( &psz_dir, "%s" DIR_SEP CONFIG_DIR, psz_parent ) == -1 )
779 /* XDG Base Directory Specification - Version 0.6 */
780 char *psz_env = getenv( "XDG_DATA_HOME" );
783 if( asprintf( &psz_dir, "%s/vlc", psz_env ) == -1 )
787 psz_env = getenv( "HOME" );
788 if( !psz_env ) psz_env = p_libvlc->psz_homedir; /* not part of XDG spec but we want a sensible fallback */
789 if( asprintf( &psz_dir, "%s/.local/share/vlc", psz_env ) == -1 )
796 * Get the user's VLC cache directory
797 * (used for stuff like the modules cache, the album art cache, ...)
799 char *config_GetCacheDir( libvlc_int_t *p_libvlc )
802 #if defined(WIN32) || defined(__APPLE__) || defined(SYS_BEOS)
803 char *psz_parent = config_GetUserDir();
804 if( !psz_parent ) psz_parent = p_libvlc->psz_homedir;
805 if( asprintf( &psz_dir, "%s" DIR_SEP CONFIG_DIR, psz_parent ) == -1 )
809 /* XDG Base Directory Specification - Version 0.6 */
810 char *psz_env = getenv( "XDG_CACHE_HOME" );
813 if( asprintf( &psz_dir, "%s/vlc", psz_env ) == -1 )
817 psz_env = getenv( "HOME" );
818 if( !psz_env ) psz_env = p_libvlc->psz_homedir; /* not part of XDG spec but we want a sensible fallback */
819 if( asprintf( &psz_dir, "%s/.cache/vlc", psz_env ) == -1 )
825 /* Adds an extra interface to the configuration */
826 void __config_AddIntf( vlc_object_t *p_this, const char *psz_intf )
830 char *psz_config, *psz_parser;
831 size_t i_len = strlen( psz_intf );
833 psz_config = psz_parser = config_GetPsz( p_this->p_libvlc, "control" );
836 if( !strncmp( psz_intf, psz_parser, i_len ) )
841 psz_parser = strchr( psz_parser, ':' );
842 if( psz_parser ) psz_parser++; /* skip the ':' */
846 psz_config = psz_parser = config_GetPsz( p_this->p_libvlc, "extraintf" );
849 if( !strncmp( psz_intf, psz_parser, i_len ) )
854 psz_parser = strchr( psz_parser, ':' );
855 if( psz_parser ) psz_parser++; /* skip the ':' */
858 /* interface not found in the config, let's add it */
859 if( psz_config && strlen( psz_config ) > 0 )
862 if( asprintf( &psz_newconfig, "%s:%s", psz_config, psz_intf ) != -1 )
864 config_PutPsz( p_this->p_libvlc, "extraintf", psz_newconfig );
865 free( psz_newconfig );
869 config_PutPsz( p_this->p_libvlc, "extraintf", psz_intf );
874 /* Removes an extra interface from the configuration */
875 void __config_RemoveIntf( vlc_object_t *p_this, const char *psz_intf )
879 char *psz_config, *psz_parser;
880 size_t i_len = strlen( psz_intf );
882 psz_config = psz_parser = config_GetPsz( p_this->p_libvlc, "extraintf" );
885 if( !strncmp( psz_intf, psz_parser, i_len ) )
888 char *psz_end = psz_parser + i_len;
889 if( *psz_end == ':' ) psz_end++;
891 if( asprintf( &psz_newconfig, "%s%s", psz_config, psz_end ) != -1 )
893 config_PutPsz( p_this->p_libvlc, "extraintf", psz_newconfig );
894 free( psz_newconfig );
898 psz_parser = strchr( psz_parser, ':' );
899 if( psz_parser ) psz_parser++; /* skip the ':' */
903 psz_config = psz_parser = config_GetPsz( p_this->p_libvlc, "control" );
906 if( !strncmp( psz_intf, psz_parser, i_len ) )
909 char *psz_end = psz_parser + i_len;
910 if( *psz_end == ':' ) psz_end++;
912 if( asprintf( &psz_newconfig, "%s%s", psz_config, psz_end ) != -1 )
914 config_PutPsz( p_this->p_libvlc, "control", psz_newconfig );
915 free( psz_newconfig );
919 psz_parser = strchr( psz_parser, ':' );
920 if( psz_parser ) psz_parser++; /* skip the ':' */
926 * Returns VLC_TRUE if the specified extra interface is present in the
927 * configuration, VLC_FALSE if not
929 vlc_bool_t __config_ExistIntf( vlc_object_t *p_this, const char *psz_intf )
933 char *psz_config, *psz_parser;
934 size_t i_len = strlen( psz_intf );
936 psz_config = psz_parser = config_GetPsz( p_this->p_libvlc, "extraintf" );
939 if( !strncmp( psz_parser, psz_intf, i_len ) )
944 psz_parser = strchr( psz_parser, ':' );
945 if( psz_parser ) psz_parser++; /* skip the ':' */
949 psz_config = psz_parser = config_GetPsz( p_this->p_libvlc, "control" );
952 if( !strncmp( psz_parser, psz_intf, i_len ) )
957 psz_parser = strchr( psz_parser, ':' );
958 if( psz_parser ) psz_parser++; /* skip the ':' */