Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yabberyabber committed Jan 31, 2024
1 parent 3860153 commit 107f126
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
35 changes: 17 additions & 18 deletions err.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,28 @@ int err_flags = 0;
being the most verbose and 0 being the least verbose. The default
verbosity level is 1. */

static int parsedverbosity()
noreturn void err(int eval, const char *fmt, ...);
static int parsedverbosity(void)
{
char *pszVerbosity = getenv("BST_VERBOSITY");
if (pszVerbosity == NULL) {
return 1;
}
char *endPtr;
int iVerbosity = strtol(pszVerbosity, &endPtr, 10);
if (*endPtr != '\0') {
// Soemthing went wrong during parsing. This isn't
// critical so let's just ignore the parameter.
return 1;
}
return iVerbosity;
char *pszVerbosity = getenv("BST_VERBOSITY");
if (pszVerbosity == NULL) {
return 1;
}
char *endPtr;
int iVerbosity = strtol(pszVerbosity, &endPtr, 10);
if (*endPtr != '\0') {
err(2, "un-parsable value of BST_VERBOSITY");
}
return iVerbosity;
}

void init_logverbosity()
void init_logverbosity(void)
{
int iVerbosity = parsedverbosity();
int iVerbosity = parsedverbosity();

if (iVerbosity >= 1) {
err_flags |= ERR_VERBOSE;
}
if (iVerbosity >= 1) {
err_flags |= ERR_VERBOSE;
}
}

/* fdprintf and vfdprintf are fork-safe versions of fprintf and vfprintf. */
Expand Down
2 changes: 1 addition & 1 deletion errutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
enum {
ERR_USE_SYSLOG = 1,

ERR_VERBOSE = 2,
ERR_VERBOSE = 2,
};

extern void (*err_exit)(int);
Expand Down

0 comments on commit 107f126

Please sign in to comment.