config file now may contain tabs also as white space

This commit is contained in:
darkeye 2001-10-19 09:20:09 +00:00
parent d5d86896be
commit 35e0d6884b
5 changed files with 29 additions and 10 deletions

View File

@ -3,7 +3,7 @@ DarkIce 0.7
o added support for FreeBSD
thanks to Robin P. Blanchard, <Robin_Blanchard@gactr.uga.edu>
o added support for resampling mp3 streams
o DarkIce config file now may contain spaces and tabs as white space
18-09-2001: DarkIce 0.6 released

View File

@ -7,4 +7,5 @@ o libtoolize ?
o revisit real-time scheduling and one-thread-per-connection
o look into performance
o create proper error-reporting module
o enable TABs in the config file
o configure options to enable / disable lame / ogg support and to
specify their location

View File

@ -1,10 +1,10 @@
.TH darkice.cfg 5 "September 18, 2001" "DarkIce" "DarkIce live audio streamer"
.TH darkice.cfg 5 "October 19, 2001" "DarkIce" "DarkIce live audio streamer"
.SH NAME
darkice.cfg \- configuration file for darkice
.SH DESCRIPTION
.PP
The configuration file consists of sections, with key = value pairs
separated with spaces (not tabs) inside each secion:
separated with spaces and/or tabs inside each secion:
.nf
[section1]

View File

@ -58,6 +58,12 @@ static const char fileid[] = "$Id$";
#define LINE_SIZE 256
/*------------------------------------------------------------------------------
* string containing all white space characters
*----------------------------------------------------------------------------*/
#define WHITE_SPACE_STR " \t"
/* =============================================== local function prototypes */
@ -99,11 +105,11 @@ Config :: addLine ( const char * line ) throw ( Exception )
str.erase( ix);
}
/* eat up all white space from the front */
if ( (ix = str.find_first_not_of( ' ')) != str.npos ) {
if ( (ix = str.find_first_not_of( WHITE_SPACE_STR)) != str.npos ) {
str.erase( 0, ix);
}
/* eat up all white space from the end */
if ( (ix = str.find_last_not_of( ' ')) != str.npos ) {
if ( (ix = str.find_last_not_of( WHITE_SPACE_STR)) != str.npos ) {
str.erase( ix + 1);
}
@ -164,6 +170,9 @@ Config :: read ( istream & is ) throw ( Exception )
$Source$
$Log$
Revision 1.6 2001/10/19 09:20:09 darkeye
config file now may contain tabs also as white space
Revision 1.5 2001/09/09 11:26:43 darkeye
full line comments skipped earlier: commens allowed before the first secion

View File

@ -52,6 +52,12 @@
static const char fileid[] = "$Id$";
/*------------------------------------------------------------------------------
* string containing all white space characters
*----------------------------------------------------------------------------*/
#define WHITE_SPACE_STR " \t"
/* =============================================== local function prototypes */
@ -133,11 +139,11 @@ ConfigSection :: addLine ( const char * line ) throw ( Exception )
str.erase( ix);
}
/* eat up all white space from the front */
if ( (ix = str.find_first_not_of( ' ')) != str.npos ) {
if ( (ix = str.find_first_not_of( WHITE_SPACE_STR)) != str.npos ) {
str.erase( 0, ix);
}
/* eat up all white space from the end */
if ( (ix = str.find_last_not_of( ' ')) != str.npos ) {
if ( (ix = str.find_last_not_of( WHITE_SPACE_STR)) != str.npos ) {
str.erase( ix + 1);
}
if ( !str.length() ) {
@ -153,11 +159,11 @@ ConfigSection :: addLine ( const char * line ) throw ( Exception )
std::string value( str, ix + 1);
/* eat up all white space from the front of value */
if ( (ix = value.find_first_not_of( ' ')) != value.npos ) {
if ( (ix = value.find_first_not_of( WHITE_SPACE_STR)) != value.npos ) {
value.erase( 0, ix);
}
/* eat up all white space from the end of key */
if ( (ix = key.find_last_not_of( ' ')) != key.npos ) {
if ( (ix = key.find_last_not_of( WHITE_SPACE_STR)) != key.npos ) {
key.erase( ix + 1);
}
@ -171,6 +177,9 @@ ConfigSection :: addLine ( const char * line ) throw ( Exception )
$Source$
$Log$
Revision 1.7 2001/10/19 09:20:09 darkeye
config file now may contain tabs also as white space
Revision 1.6 2001/09/09 11:26:43 darkeye
full line comments skipped earlier: commens allowed before the first secion