summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2007-05-19 17:29:18 +0200
committerDavid Härdeman <david@hardeman.nu>2007-05-19 17:29:18 +0200
commita5ed124b6556e1205bdfa8ad4529cef7d1a33e54 (patch)
treeb653e1939f1bd1c6602facbb63f09e97afd2e359
parenta4e5b979d910384577750a4672fee44e7c468bd0 (diff)
And remove another global variable (verbosity)
-rw-r--r--metastore.c8
-rw-r--r--utils.c9
-rw-r--r--utils.h4
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;
diff --git a/utils.c b/utils.c
index 3c73c6b..67fdc76 100644
--- a/utils.c
+++ b/utils.c
@@ -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
diff --git a/utils.h b/utils.h
index 76d6ca5..3bce297 100644
--- a/utils.h
+++ b/utils.h
@@ -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