diff options
author | David Härdeman <david@hardeman.nu> | 2007-05-19 17:29:18 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2007-05-19 17:29:18 +0200 |
commit | a5ed124b6556e1205bdfa8ad4529cef7d1a33e54 (patch) | |
tree | b653e1939f1bd1c6602facbb63f09e97afd2e359 | |
parent | a4e5b979d910384577750a4672fee44e7c468bd0 (diff) |
And remove another global variable (verbosity)
-rw-r--r-- | metastore.c | 8 | ||||
-rw-r--r-- | utils.c | 9 | ||||
-rw-r--r-- | utils.h | 4 |
3 files changed, 14 insertions, 7 deletions
diff --git a/metastore.c b/metastore.c index 2db4c31..d831aa7 100644 --- a/metastore.c +++ b/metastore.c @@ -249,10 +249,10 @@ main(int argc, char **argv, char **envp) switch (c) { case 0: if (!strcmp("verbose", long_options[option_index].name)) { - verbosity++; + adjust_verbosity(1); } else if (!strcmp("quiet", long_options[option_index].name)) { - verbosity--; + adjust_verbosity(-1); } else if (!strcmp("mtime", long_options[option_index].name)) { do_mtime = 1; @@ -278,10 +278,10 @@ main(int argc, char **argv, char **envp) i++; break; case 'v': - verbosity++; + adjust_verbosity(1); break; case 'q': - verbosity--; + adjust_verbosity(-1); break; case 'm': do_mtime = 1; @@ -28,7 +28,14 @@ #include "utils.h" /* Controls the verbosity level for msg() */ -int verbosity = 0; +static int verbosity = 0; + +/* Adjusts the verbosity level for msg() */ +void +adjust_verbosity(int adj) +{ + verbosity += adj; +} /* * Prints messages to console according to the current verbosity @@ -21,8 +21,8 @@ /* For uint64_t */ #include <stdint.h> -/* Controls the verbosity level for msg() */ -extern int verbosity; +/* Adjusts the verbosity level for msg() */ +void adjust_verbosity(int adj); /* Verbosity levels using stdout */ #define MSG_NORMAL 0 |