diff options
author | Holger Hetterich <hhetter@novell.com> | 2010-02-14 19:05:00 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2010-02-15 08:31:44 +0100 |
commit | 6ec6fa0ac4e71f9b14a3cbfef328d50e321b0544 (patch) | |
tree | cdc11b009dabc4746f0fae769cb77e7a366139c6 /source3/utils | |
parent | d3a42946cc7d98070e90122341d234119ed94089 (diff) | |
download | samba-6ec6fa0ac4e71f9b14a3cbfef328d50e321b0544.tar.gz samba-6ec6fa0ac4e71f9b14a3cbfef328d50e321b0544.tar.bz2 samba-6ec6fa0ac4e71f9b14a3cbfef328d50e321b0544.zip |
s3: eventlogadm.c: add -s option to use alternative config file.
Update the manpage accordingly.
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/eventlogadm.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/source3/utils/eventlogadm.c b/source3/utils/eventlogadm.c index 415330f68c..d94f25b42d 100644 --- a/source3/utils/eventlogadm.c +++ b/source3/utils/eventlogadm.c @@ -40,6 +40,7 @@ static void usage( char *s ) printf( " -o addsource <EventlogName> <sourcename> <msgfileDLLname> \tAdds the specified source & DLL eventlog registry entry\n" ); printf( " -o dump <Eventlog Name> <starting_record>\t\t\t\t\tDump stored eventlog entries on STDOUT\n" ); printf( "\nMiscellaneous options:\n" ); + printf( " -s <filename>\t\t\t\t\t\t\tUse configuration file <filename>.\n"); printf( " -d\t\t\t\t\t\t\t\tturn debug on\n" ); printf( " -h\t\t\t\t\t\t\t\tdisplay help\n\n" ); } @@ -50,7 +51,7 @@ static void display_eventlog_names( void ) int i; elogs = lp_eventlog_list( ); - printf( "Active eventlog names (from smb.conf):\n" ); + printf( "Active eventlog names:\n" ); printf( "--------------------------------------\n" ); if ( elogs ) { for ( i = 0; elogs[i]; i++ ) { @@ -220,6 +221,7 @@ int main( int argc, char *argv[] ) { int opt, rc; char *exename; + char *configfile = NULL; TALLOC_CTX *frame = talloc_stackframe(); @@ -229,8 +231,6 @@ int main( int argc, char *argv[] ) opt_debug = 0; /* todo set this from getopts */ - lp_load(get_dyn_CONFIGFILE(), True, False, False, True); - exename = argv[0]; /* default */ @@ -240,7 +240,7 @@ int main( int argc, char *argv[] ) #if 0 /* TESTING CODE */ eventlog_add_source( "System", "TestSourceX", "SomeTestPathX" ); #endif - while ( ( opt = getopt( argc, argv, "dho:" ) ) != EOF ) { + while ( ( opt = getopt( argc, argv, "dho:s:" ) ) != EOF ) { switch ( opt ) { case 'o': @@ -256,6 +256,10 @@ int main( int argc, char *argv[] ) case 'd': opt_debug = 1; break; + case 's': + configfile = talloc_strdup(frame, optarg); + break; + } } @@ -268,6 +272,13 @@ int main( int argc, char *argv[] ) exit( 1 ); } + if ( configfile == NULL ) { + lp_load(get_dyn_CONFIGFILE(), True, False, False, True); + } else if (!lp_load(configfile, True, False, False, True)) { + printf("Unable to parse configfile '%s'\n",configfile); + exit( 1 ); + } + /* note that the separate command types should call usage if they need to... */ while ( 1 ) { if ( !StrCaseCmp( opname, "addsource" ) ) { |