* Declaration and extern access to global program object.
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
- * $Id: main.h,v 1.57 2004/01/25 18:17:08 zorglub Exp $
+ * $Id$
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
module_bank_t * p_module_bank;
/* Arch-specific variables */
+#if !defined( WIN32 )
+ vlc_bool_t b_daemon;
+#endif
#if defined( SYS_BEOS )
vlc_object_t * p_appthread;
char * psz_vlcpath;
{
p_vlc->pf_memset = memset;
}
+
+ /* Check for daemon mode */
+ if( config_GetInt( p_vlc, "daemon" ) )
+ {
+ pid_t i_pid = 0;
+ if( ( i_pid = fork() ) < 0 )
+ {
+ msg_Err( p_vlc, "Unable to fork vlc to daemon mode" );
+ exit(1);
+ }
+ else if( i_pid )
+ {
+ /* This is the parent, exit right now */
+ msg_Dbg( p_vlc, "closing parent process" );
+ exit(0);
+ }
+ else
+ {
+ /* we are the child */
+ msg_Dbg( p_vlc, "we are the child !!!" );
+ close( 0 );
+ close( 1 );
+ close( 2 );
+
+ p_vlc->p_libvlc->b_daemon = VLC_TRUE;
+ //VLC_AddIntf( 0, "logger,none", VLC_FALSE, VLC_FALSE );
+ }
+ }
/*
* Initialize hotkey handling
"This option allows you to use a plugins cache which will greatly " \
"improve the start time of VLC.")
+#define DAEMON_TEXT N_("Run as daemon proces")
+#define DAEMON_LONGTEXT N_( \
+ "Runs VLC as a background daemon proces.")
+
#define ONEINSTANCE_TEXT N_("Allow only one running instance")
#define ONEINSTANCE_LONGTEXT N_( \
"Allowing only one running instance of VLC can sometimes be useful, " \
DEMUX_LONGTEXT, VLC_TRUE );
add_bool( "minimize-threads", 0, NULL, MINIMIZE_THREADS_TEXT,
MINIMIZE_THREADS_LONGTEXT, VLC_TRUE );
- add_directory( "plugin-path", NULL, NULL, PLUGIN_PATH_TEXT,
- PLUGIN_PATH_LONGTEXT, VLC_TRUE );
add_bool( "plugins-cache", 0, NULL, PLUGINS_CACHE_TEXT,
PLUGINS_CACHE_LONGTEXT, VLC_TRUE );
+ add_directory( "plugin-path", NULL, NULL, PLUGIN_PATH_TEXT,
+ PLUGIN_PATH_LONGTEXT, VLC_TRUE );
+
+#if !defined(WIN32)
+ add_bool( "daemon", 0, NULL, DAEMON_TEXT,
+ DAEMON_LONGTEXT, VLC_TRUE );
+ change_short('d');
+#endif
#if !defined(SYS_DARWIN) && !defined(SYS_BEOS) && defined(PTHREAD_COND_T_IN_PTHREAD_H)
add_bool( "rt-priority", 0, NULL, RT_PRIORITY_TEXT,