Decrease verbosity of devmand.

Display warnings(non critical errors) only when the verbose flag
is set.
This commit is contained in:
Kees Jongenburger 2012-06-19 10:14:14 +00:00
parent cb1418a5e1
commit a55f435a36

View file

@ -329,21 +329,20 @@ static void parse_config()
status = stat(dirname,&stats); status = stat(dirname,&stats);
if (status == -1){ if (status == -1){
error = errno; error = errno;
fprintf(stderr,"Failed to read directory '%s':%s" dbg("Failed to read directory '%s':%s (skipping) \n",
" (skipping) \n", dirname,strerror(error)); dirname,strerror(error));
continue; continue;
} }
if (!S_ISDIR(stats.st_mode)){ if (!S_ISDIR(stats.st_mode)){
fprintf(stderr,"Parse configuration skipping %s" dbg("Parse configuration skipping %s "
" (not a directory) \n",dirname); "(not a directory) \n",dirname);
continue; continue;
} }
dir = opendir(dirname); dir = opendir(dirname);
if (dir == NULL){ if (dir == NULL){
error = errno; error = errno;
fprintf(stderr,"Parse configuration failed to read" dbg("Parse configuration failed to read dir '%s'"
" dir '%s' (skipping) :%s\n",dirname, "(skipping) :%s\n",dirname, strerror(error));
strerror(error));
continue; continue;
} }
while( (status = readdir_r(dir,&entry,&result)) == 0 ){ while( (status = readdir_r(dir,&entry,&result)) == 0 ){
@ -358,16 +357,16 @@ static void parse_config()
status = stat(config_file, &stats); status = stat(config_file, &stats);
if (status == -1){ if (status == -1){
error = errno; error = errno;
fprintf(stderr,"Parse configuration Failed to stat" dbg("Parse configuration Failed to stat file "
" file '%s': %s (skipping)\n", "'%s': %s (skipping)\n", config_file,
config_file,strerror(error)); strerror(error));
} }
if (S_ISREG(stats.st_mode)){ if (S_ISREG(stats.st_mode)){
dbg("Parsing file %s",config_file); dbg("Parsing file %s",config_file);
yyin = fopen(config_file, "r"); yyin = fopen(config_file, "r");
if (yyin < 0) { if (yyin < 0) {
printf("Can not open config file:" dbg("Can not open config file:"
" %d.\n", errno); " %d.\n", errno);
} }
yyparse(); yyparse();