added default configuration file handling, closes #6

This commit is contained in:
darkeye 2007-01-14 13:01:58 +00:00
parent 0bfed4a3ae
commit cf2d4c85f0
3 changed files with 12 additions and 8 deletions

View File

@ -1,5 +1,7 @@
DarkIce next release
o added default configuration file handling - if no configuration file
is specified, /etc/darkice.cfg is used
o fix to enable compiling on 64 bit platforms
thanks to Alexander Vlasov <zulu@galaradio.com> and
Mariusz Mazur <mmazur@kernel.pl>

View File

@ -1,4 +1,4 @@
.TH darkice 1 "January 25, 2006" "DarkIce" "DarkIce live audio streamer"
.TH darkice 1 "January 14, 2007" "DarkIce" "DarkIce live audio streamer"
.SH NAME
darkice \- an icecast / shoutcast live audio streamer
.SH SYNOPSIS
@ -49,6 +49,7 @@ is run as root.
.TP
.BI "\-c " config.file
Specifies what configuration file to use.
If not specified, /etc/darkice.cfg will be used.
.TP
.BI "\-v " n

View File

@ -62,6 +62,11 @@
*----------------------------------------------------------------------------*/
static const char fileid[] = "$Id$";
/*------------------------------------------------------------------------------
* Default config file name
*----------------------------------------------------------------------------*/
static const char *DEFAULT_CONFIG_FILE = "/etc/darkice.cfg";
/* =============================================== local function prototypes */
@ -91,7 +96,7 @@ main (
<< std::endl << std::endl;
try {
const char * configFileName = 0;
const char * configFileName = DEFAULT_CONFIG_FILE;
unsigned int verbosity = 1;
int i;
const char opts[] = "hc:v:";
@ -115,12 +120,6 @@ main (
}
}
if ( !configFileName ) {
showUsage( std::cout);
throw Exception( __FILE__, __LINE__,
"no configuration file specified");
}
std::cout << "Using config file: " << configFileName << std::endl;
std::ifstream configFile( configFileName);
@ -153,6 +152,8 @@ showUsage ( std::ostream & os )
<< std::endl
<< " -c config.file use configuration file config.file"
<< std::endl
<< " if not specified, /etc/darkice.cfg is used"
<< std::endl
<< " -v n verbosity level (0 = silent, 10 = loud)"
<< std::endl
<< " -h print this message and exit"