aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--daemon/conf.c4
-rw-r--r--daemon/main.c14
-rw-r--r--daemon/syslogd.h2
3 files changed, 18 insertions, 2 deletions
diff --git a/daemon/conf.c b/daemon/conf.c
index 9be1c18..a80a689 100644
--- a/daemon/conf.c
+++ b/daemon/conf.c
@@ -948,7 +948,9 @@ gboolean read_configuration()
TRACE_ENTER( "\n" );
- if( '\\' == syslog_conf_dir[0] || '/' == syslog_conf_dir[0] || ':' == syslog_conf_dir[1] )
+ if( conf_file_name )
+ pathname = g_strdup( conf_file_name );
+ else if( '\\' == syslog_conf_dir[0] || '/' == syslog_conf_dir[0] || ':' == syslog_conf_dir[1] )
/* absolute path */
pathname = g_build_filename( syslog_conf_dir, "syslog.conf", NULL );
else
diff --git a/daemon/main.c b/daemon/main.c
index 1a691ab..439138d 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -45,6 +45,7 @@ static SERVICE_STATUS_HANDLE hss;
static SERVICE_STATUS sstatus;
/* options */
+char *conf_file_name = NULL;
static char *instance_name = NULL;
static char *priority = NULL;
@@ -368,6 +369,11 @@ static BOOL install_service()
}
strcat( command_line, __argv[0] );
strcat( command_line, " --service" );
+ if( conf_file_name )
+ {
+ strcat( command_line, " --conf " );
+ strcat( command_line, conf_file_name );
+ }
if( priority )
{
strcat( command_line, " --priority " );
@@ -603,6 +609,7 @@ int main( int argc, char* argv[] )
{
static struct option long_options[] =
{
+ { "conf", required_argument, NULL, 'c'},
{ "verbose", no_argument, NULL, 'v'},
{ "help", no_argument, &help_flag, 1 },
{ "version", no_argument, &version_flag, 1 },
@@ -619,7 +626,7 @@ int main( int argc, char* argv[] )
int option_char;
int option_index;
- option_char = getopt_long( argc, argv, "vhirsI:p:",
+ option_char = getopt_long( argc, argv, "c:vhirsI:p:",
long_options, &option_index );
if( -1 == option_char )
break;
@@ -629,6 +636,10 @@ int main( int argc, char* argv[] )
case 0:
break;
+ case 'c':
+ conf_file_name = optarg;
+ break;
+
case 'v':
verbosity_level++;
break;
@@ -736,6 +747,7 @@ int main( int argc, char* argv[] )
printf( "Usage: syslogd [OPTION]\n" );
printf( "This is syslog daemon for windows.\n" );
printf( "\n" );
+ printf( "-c, --conf\tspecify alternate configuration file\n" );
printf( "-v, --verbose\tbe verbose; each occurence of this parameter\n"
"\t\tincreases verbosity\n" );
printf( "-i, --install\tinstall and start service\n" );
diff --git a/daemon/syslogd.h b/daemon/syslogd.h
index b7569bb..05d2b9a 100644
--- a/daemon/syslogd.h
+++ b/daemon/syslogd.h
@@ -51,6 +51,8 @@ extern gsize string_concat( gchar** result, struct string* s, ... );
extern gboolean string_equal( struct string* s1, struct string* s2 );
/* misc global stuff */
+extern char *conf_file_name;
+
extern HANDLE service_stop_event;
extern struct string *local_hostname;