From e0798ccc765b309b62844de1ef1ce33bbf558484 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 31 Jul 2008 23:27:13 +0100 Subject: Fixed #440: If there's a -R command line flag, store the passed filename in the state environment variable (unless it's set already). --- conf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'conf.c') diff --git a/conf.c b/conf.c index 909d331a..8e6b6c69 100644 --- a/conf.c +++ b/conf.c @@ -77,7 +77,7 @@ conf_t *conf_load( int argc, char *argv[] ) at a *valid* configuration file. */ } - while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hu:" ) ) >= 0 ) + while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:u:" ) ) >= 0 ) /* ^^^^ Just to make sure we skip this step from the REHASH handler. */ { if( opt == 'i' ) @@ -145,6 +145,13 @@ conf_t *conf_load( int argc, char *argv[] ) " -h Show this help page.\n" ); return NULL; } + else if( opt == 'R' ) + { + /* Backward compatibility; older BitlBees passed this + info using a command-line flag. Allow people to + upgrade from such a version for now. */ + setenv( "_BITLBEE_RESTART_STATE", optarg, 0 ); + } else if( opt == 'u' ) { g_free( conf->user ); -- cgit v1.2.3 From 489f996fe52c6969a9574d5ca562a4f5cb5c2585 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 25 Dec 2008 11:05:11 +0000 Subject: Simplified ini parser code a bit more. Not using strtok() after all since I can't find a guarantee that it's okay with me further mutilating the strings. :-) --- conf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'conf.c') diff --git a/conf.c b/conf.c index 8e6b6c69..873aa0e7 100644 --- a/conf.c +++ b/conf.c @@ -307,15 +307,15 @@ static int conf_loadini( conf_t *conf, char *file ) } else { - fprintf( stderr, "Error: Unknown setting `%s` in configuration file.\n", ini->key ); + fprintf( stderr, "Error: Unknown setting `%s` in configuration file (line %d).\n", ini->key, ini->line ); return 0; /* For now just ignore unknown keys... */ } } else if( g_strcasecmp( ini->section, "defaults" ) != 0 ) { - fprintf( stderr, "Error: Unknown section [%s] in configuration file. " - "BitlBee configuration must be put in a [settings] section!\n", ini->section ); + fprintf( stderr, "Error: Unknown section [%s] in configuration file (line %d). " + "BitlBee configuration must be put in a [settings] section!\n", ini->section, ini->line ); return 0; } } -- cgit v1.2.3