diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-12-09 10:40:59 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-12-09 10:40:59 +0000 |
commit | 1c1693d9c1aa6d23032a6f3e6caff3a53b6df4ec (patch) | |
tree | 1f85c11e7fdc6a8689bf20888a46988f0c23fa7d /src/statistics | |
parent | 2b62f9889b33905d9e08a8052bd93c9f51ec7e6f (diff) | |
download | gnunet-1c1693d9c1aa6d23032a6f3e6caff3a53b6df4ec.tar.gz gnunet-1c1693d9c1aa6d23032a6f3e6caff3a53b6df4ec.zip |
added quiet mode just printing the value
Diffstat (limited to 'src/statistics')
-rw-r--r-- | src/statistics/gnunet-statistics.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c index 80488958f..0f2c92582 100644 --- a/src/statistics/gnunet-statistics.c +++ b/src/statistics/gnunet-statistics.c | |||
@@ -53,6 +53,11 @@ static char *name; | |||
53 | static int persistent; | 53 | static int persistent; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Quiet mode | ||
57 | */ | ||
58 | static int quiet; | ||
59 | |||
60 | /** | ||
56 | * Callback function to process statistic values. | 61 | * Callback function to process statistic values. |
57 | * | 62 | * |
58 | * @param cls closure | 63 | * @param cls closure |
@@ -66,8 +71,12 @@ static int | |||
66 | printer (void *cls, const char *subsystem, const char *name, uint64_t value, | 71 | printer (void *cls, const char *subsystem, const char *name, uint64_t value, |
67 | int is_persistent) | 72 | int is_persistent) |
68 | { | 73 | { |
69 | FPRINTF (stdout, "%s%-12s %-50s: %16llu\n", is_persistent ? "!" : " ", | 74 | if (quiet == GNUNET_NO) |
75 | FPRINTF (stdout, "%s%-12s %-50s: %16llu\n", is_persistent ? "!" : " ", | ||
70 | subsystem, _(name), (unsigned long long) value); | 76 | subsystem, _(name), (unsigned long long) value); |
77 | else | ||
78 | FPRINTF (stdout, "%llu\n", (unsigned long long) value); | ||
79 | |||
71 | return GNUNET_OK; | 80 | return GNUNET_OK; |
72 | } | 81 | } |
73 | 82 | ||
@@ -152,7 +161,7 @@ main (int argc, char *const *argv) | |||
152 | { | 161 | { |
153 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 162 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { |
154 | {'n', "name", "NAME", | 163 | {'n', "name", "NAME", |
155 | gettext_noop ("limit output to statistcs for the given NAME"), 1, | 164 | gettext_noop ("limit output to statistics for the given NAME"), 1, |
156 | &GNUNET_GETOPT_set_string, &name}, | 165 | &GNUNET_GETOPT_set_string, &name}, |
157 | {'p', "persistent", NULL, | 166 | {'p', "persistent", NULL, |
158 | gettext_noop ("make the value being set persistent"), 0, | 167 | gettext_noop ("make the value being set persistent"), 0, |
@@ -160,6 +169,9 @@ main (int argc, char *const *argv) | |||
160 | {'s', "subsystem", "SUBSYSTEM", | 169 | {'s', "subsystem", "SUBSYSTEM", |
161 | gettext_noop ("limit output to the given SUBSYSTEM"), 1, | 170 | gettext_noop ("limit output to the given SUBSYSTEM"), 1, |
162 | &GNUNET_GETOPT_set_string, &subsystem}, | 171 | &GNUNET_GETOPT_set_string, &subsystem}, |
172 | {'q', "quiet", NULL, | ||
173 | gettext_noop ("just print the statistics value"), 0, | ||
174 | &GNUNET_GETOPT_set_one, &quiet}, | ||
163 | GNUNET_GETOPT_OPTION_END | 175 | GNUNET_GETOPT_OPTION_END |
164 | }; | 176 | }; |
165 | return (GNUNET_OK == | 177 | return (GNUNET_OK == |