Debug info before opening log and debug files - fixes4

master
Alexey Khromov 6 months ago
parent c766c4a9f7
commit a6a1dc2881

@ -159,7 +159,7 @@ int conf_readconf(const char *confname, int inclevel)
if( i != (int)bforce_config[i].real_key )
{
#ifdef DEBUG
fprintf(stderr,"BF-DEBUG: invalid config table: found %d instead of %d",
fprintf(stderr,"BF-DEBUG: invalid config table: found %d instead of %d\n",
bforce_config[i].real_key, i);
#endif
return -1;
@ -170,12 +170,12 @@ int conf_readconf(const char *confname, int inclevel)
if( (fp = file_open(confname,"r")) == NULL )
{
#ifdef DEBUG
fprintf(stderr,"BF-DEBUG: can't open config file \"%s\"", confname);
fprintf(stderr,"BF-DEBUG: can't open config file \"%s\"\n", confname);
#endif
return(PROC_RC_IGNORE);
}
#ifdef DEBUG
fprintf(stderr,"BF-DEBUG: start reading config \"%s\"", confname);
fprintf(stderr,"BF-DEBUG: start reading config \"%s\"\n", confname);
#endif
while( fgets(tmp, sizeof(tmp), fp) )
@ -188,7 +188,7 @@ int conf_readconf(const char *confname, int inclevel)
if( isifexpr )
{
#ifdef DEBUG
fprintf(stderr,"BF-DEBUG: warning: automatically close expression at empty line %d", line);
fprintf(stderr,"BF-DEBUG: warning: automatically close expression at empty line %d\n", 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
fprintf(stderr,"BF-DEBUG: warning: appending empty or comment line %d", line);
fprintf(stderr,"BF-DEBUG: warning: appending empty or comment line %d\n", 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
fprintf(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\"\n",
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
fprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive", p_key);
fprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive\n", p_key);
#endif
rc = PROC_RC_IGNORE;
}
else if( inclevel < MAXINCLUDELEVEL )
{
#ifdef DEBUG
fprintf(stderr, "BF-DEBUG: conf_readconf: process inlude file \"%s\"", value);
fprintf(stderr, "BF-DEBUG: conf_readconf: process inlude file \"%s\"\n", value);
#endif
rc = conf_readconf(value, inclevel + 1);
if( rc ) rc = PROC_RC_IGNORE;
@ -285,9 +285,8 @@ int conf_readconf(const char *confname, int inclevel)
else
{
#ifdef DEBUG
fprintf(stderr, "BF-DEBUG: conf_readconf: too deep include");
fprintf(stderr, "BF-DEBUG: conf_readconf: too deep include\n");
#endif
log("including level too deep");
rc = PROC_RC_IGNORE;
}
}
@ -296,7 +295,7 @@ int conf_readconf(const char *confname, int inclevel)
if( value || isifexpr )
{
#ifdef DEBUG
fprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive", p_key);
fprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive\n", p_key);
#endif
rc = PROC_RC_ABORT;
}
@ -314,7 +313,7 @@ int conf_readconf(const char *confname, int inclevel)
if( value || expr || !isifexpr )
{
#ifdef DEBUG
fprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive", p_key);
fprintf(stderr, "BF-DEBUG: incorrect usage of `%s' directive\n", p_key);
#endif
rc = PROC_RC_IGNORE;
}
@ -328,7 +327,7 @@ int conf_readconf(const char *confname, int inclevel)
else
{
#ifdef DEBUG
fprintf(stderr, "BF-DEBUG: unknown directive `%s'", p_key);
fprintf(stderr, "BF-DEBUG: unknown directive `%s'\n", p_key);
#endif
rc = PROC_RC_IGNORE;
}
@ -338,7 +337,7 @@ int conf_readconf(const char *confname, int inclevel)
if( isifexpr && expr )
{
#ifdef DEBUG
fprintf(stderr, "BF-DEBUG: can't use expressions inside $ifexpr block");
fprintf(stderr, "BF-DEBUG: can't use expressions inside $ifexpr block\n");
#endif
rc = PROC_RC_IGNORE;
}
@ -354,7 +353,7 @@ int conf_readconf(const char *confname, int inclevel)
else
{
#ifdef DEBUG
fprintf(stderr, "BF-DEBUG: incorrect config string");
fprintf(stderr, "BF-DEBUG: incorrect config string %s\n", fullstr);
#endif
rc = PROC_RC_IGNORE;
}
@ -371,17 +370,17 @@ int conf_readconf(const char *confname, int inclevel)
break;
case PROC_RC_WARN:
#ifdef DEBUG
fprintf(stderr, "BF-DEBUG: warning in config \"%s\" line %d", confname, line);
fprintf(stderr, "BF-DEBUG: warning in config \"%s\" line %d\n", confname, line);
#endif
break;
case PROC_RC_IGNORE:
#ifdef DEBUG
fprintf(stderr, "BF-DEBUG: ignore line %d in config \"%s\"", line, confname);
fprintf(stderr, "BF-DEBUG: ignore line %d in config \"%s\"\n", line, confname);
#endif
break;
case PROC_RC_ABORT:
#ifdef DEBUG
fprintf(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\n", confname, line);
#endif
break;
default:
@ -397,7 +396,7 @@ int conf_readconf(const char *confname, int inclevel)
{
maxrc = 1;
#ifdef DEBUG
fprintf(stderr, "BF-DEBUG: unterminated directive `#ifexp'");
fprintf(stderr, "BF-DEBUG: unterminated directive `#ifexp'\n");
#endif
}
@ -407,7 +406,7 @@ int conf_readconf(const char *confname, int inclevel)
free(ifexpr);
#ifdef DEBUG
fprintf(stderr, "BF-DEBUG: readconfig: exit with maxrc = %d", maxrc);
fprintf(stderr, "BF-DEBUG: readconfig: exit with maxrc = %d\n", maxrc);
#endif
/* update subsystems */
@ -415,7 +414,7 @@ int conf_readconf(const char *confname, int inclevel)
if( log_reopen(log_getfilename(LOG_FILE_SESSION), NULL, NULL) )
{
#ifdef DEBUG
fprintf(stderr, "BF-DEBUG: can't continue without logging");
fprintf(stderr, "BF-DEBUG: can't continue without logging\n");
#endif
exit(-1);
}

Loading…
Cancel
Save