Debug info before opening log and debug files - fixes2

master
Alexey Khromov 6 months ago
parent 89c030d26c
commit 6547b13983

@ -132,7 +132,7 @@ static void conf_parsestr(char *str, char **key, char **expr, char **value)
int conf_readconf(const char *confname, int inclevel)
{
#ifdef DEBUG
vfprintf(stderr,"BF-DEBUG: Parsing config file: %s %d\n", confname, inclevel);
fprintf(stderr,"BF-DEBUG: Parsing config file: %s %d\n", confname, inclevel);
#endif
FILE *fp = NULL;
char tmp[BF_MAXCFGLINE + 1];
@ -170,12 +170,12 @@ int conf_readconf(const char *confname, int inclevel)
if( (fp = file_open(confname,"r")) == NULL )
{
#ifdef DEBUG
vfprintf(stderr,"BF-DEBUG: can't open config file \"%s\"", confname);
fprintf(stderr,"BF-DEBUG: can't open config file \"%s\"", confname);
#endif
return(PROC_RC_IGNORE);
}
#ifdef DEBUG
vfprintf(stderr,"BF-DEBUG: start reading config \"%s\"", confname);
fprintf(stderr,"BF-DEBUG: start reading config \"%s\"", confname);
#endif
while( fgets(tmp, sizeof(tmp), fp) )
@ -188,7 +188,7 @@ int conf_readconf(const char *confname, int inclevel)
if( isifexpr )
{
#ifdef DEBUG
vfprintf(stderr,"BF-DEBUG: warning: automatically close expression at empty line %d", line);
fprintf(stderr,"BF-DEBUG: warning: automatically close expression at empty line %d", line);
#endif
if( ifexpr ) { free(ifexpr); ifexpr = NULL; }
isifexpr = FALSE;
@ -198,7 +198,7 @@ int conf_readconf(const char *confname, int inclevel)
continue;
#ifdef DEBUG
vfprintf(stderr,"BF-DEBUG: warning: appending empty or comment line %d", line);
fprintf(stderr,"BF-DEBUG: warning: appending empty or comment line %d", line);
#endif
isappend = FALSE;
@ -243,7 +243,7 @@ int conf_readconf(const char *confname, int inclevel)
conf_parsestr(fullstr ? fullstr : tmp, &p_key, &p_expr, &p_value);
#ifdef DEBUG
vfprintf(stderr, "BF-DEBUG: conf_readconf: [%d] key \"%s\" expr \"%s\" value \"%s\"",
fprintf(stderr, "BF-DEBUG: conf_readconf: [%d] key \"%s\" expr \"%s\" value \"%s\"",
line, p_key, p_expr, p_value);
#endif
@ -270,14 +270,14 @@ int conf_readconf(const char *confname, int inclevel)
if( value == NULL || expr )
{
#ifdef DEBUG
vfprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive", p_key);
fprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive", p_key);
#endif
rc = PROC_RC_IGNORE;
}
else if( inclevel < MAXINCLUDELEVEL )
{
#ifdef DEBUG
vfprintf(stderr, "BF-DEBUG: conf_readconf: process inlude file \"%s\"", value);
fprintf(stderr, "BF-DEBUG: conf_readconf: process inlude file \"%s\"", value);
#endif
rc = conf_readconf(value, inclevel + 1);
if( rc ) rc = PROC_RC_IGNORE;
@ -285,7 +285,7 @@ int conf_readconf(const char *confname, int inclevel)
else
{
#ifdef DEBUG
vfprintf(stderr, "BF-DEBUG: conf_readconf: too deep include");
fprintf(stderr, "BF-DEBUG: conf_readconf: too deep include");
#endif
log("including level too deep");
rc = PROC_RC_IGNORE;
@ -296,7 +296,7 @@ int conf_readconf(const char *confname, int inclevel)
if( value || isifexpr )
{
#ifdef DEBUG
vfprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive", p_key);
fprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive", p_key);
#endif
rc = PROC_RC_ABORT;
}
@ -314,7 +314,7 @@ int conf_readconf(const char *confname, int inclevel)
if( value || expr || !isifexpr )
{
#ifdef DEBUG
vfprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive", p_key);
fprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive", p_key);
#endif
rc = PROC_RC_IGNORE;
}
@ -328,7 +328,7 @@ int conf_readconf(const char *confname, int inclevel)
else
{
#ifdef DEBUG
vfprintf(stderr, ("BF-DEBUG: unknown directive `%s'", p_key);
fprintf(stderr, ("BF-DEBUG: unknown directive `%s'", p_key);
#endif
rc = PROC_RC_IGNORE;
}
@ -338,7 +338,7 @@ int conf_readconf(const char *confname, int inclevel)
if( isifexpr && expr )
{
#ifdef DEBUG
vfprintf(stderr, "BF-DEBUG: can't use expressions inside $ifexpr block");
fprintf(stderr, "BF-DEBUG: can't use expressions inside $ifexpr block");
#endif
rc = PROC_RC_IGNORE;
}
@ -354,7 +354,7 @@ int conf_readconf(const char *confname, int inclevel)
else
{
#ifdef DEBUG
vfprintf(stderr, "BF-DEBUG: incorrect config string");
fprintf(stderr, "BF-DEBUG: incorrect config string");
#endif
rc = PROC_RC_IGNORE;
}
@ -371,17 +371,17 @@ int conf_readconf(const char *confname, int inclevel)
break;
case PROC_RC_WARN:
#ifdef DEBUG
vfprintf(stderr, "BF-DEBUG: warning in config \"%s\" line %d", confname, line);
fprintf(stderr, "BF-DEBUG: warning in config \"%s\" line %d", confname, line);
#endif
break;
case PROC_RC_IGNORE:
#ifdef DEBUG
vfprintf(stderr, "BF-DEBUG: ignore line %d in config \"%s\"", line, confname);
fprintf(stderr, "BF-DEBUG: ignore line %d in config \"%s\"", line, confname);
#endif
break;
case PROC_RC_ABORT:
#ifdef DEBUG
vfprintf(stderr, "BF-DEBUG: fatal error in config \"%s\" in line %d", confname, line);
fprintf(stderr, "BF-DEBUG: fatal error in config \"%s\" in line %d", confname, line);
#endif
break;
default:
@ -397,7 +397,7 @@ int conf_readconf(const char *confname, int inclevel)
{
maxrc = 1;
#ifdef DEBUG
vfprintf(stderr, "BF-DEBUG: unterminated directive `#ifexp'");
fprintf(stderr, "BF-DEBUG: unterminated directive `#ifexp'");
#endif
}
@ -415,7 +415,7 @@ int conf_readconf(const char *confname, int inclevel)
if( log_reopen(log_getfilename(LOG_FILE_SESSION), NULL, NULL) )
{
#ifdef DEBUG
vfprintf(stderr, "BF-DEBUG: can't continue without logging");
fprintf(stderr, "BF-DEBUG: can't continue without logging");
#endif
exit(-1);
}

Loading…
Cancel
Save