From 1c1693d9c1aa6d23032a6f3e6caff3a53b6df4ec Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Fri, 9 Dec 2011 10:40:59 +0000 Subject: [PATCH] added quiet mode just printing the value --- src/statistics/gnunet-statistics.c | 16 ++++++++++++++-- 1 file 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 @@ -52,6 +52,11 @@ static char *name; */ static int persistent; +/** + * Quiet mode + */ +static int quiet; + /** * Callback function to process statistic values. * @@ -66,8 +71,12 @@ static int printer (void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent) { - FPRINTF (stdout, "%s%-12s %-50s: %16llu\n", is_persistent ? "!" : " ", + if (quiet == GNUNET_NO) + FPRINTF (stdout, "%s%-12s %-50s: %16llu\n", is_persistent ? "!" : " ", subsystem, _(name), (unsigned long long) value); + else + FPRINTF (stdout, "%llu\n", (unsigned long long) value); + return GNUNET_OK; } @@ -152,7 +161,7 @@ main (int argc, char *const *argv) { static const struct GNUNET_GETOPT_CommandLineOption options[] = { {'n', "name", "NAME", - gettext_noop ("limit output to statistcs for the given NAME"), 1, + gettext_noop ("limit output to statistics for the given NAME"), 1, &GNUNET_GETOPT_set_string, &name}, {'p', "persistent", NULL, gettext_noop ("make the value being set persistent"), 0, @@ -160,6 +169,9 @@ main (int argc, char *const *argv) {'s', "subsystem", "SUBSYSTEM", gettext_noop ("limit output to the given SUBSYSTEM"), 1, &GNUNET_GETOPT_set_string, &subsystem}, + {'q', "quiet", NULL, + gettext_noop ("just print the statistics value"), 0, + &GNUNET_GETOPT_set_one, &quiet}, GNUNET_GETOPT_OPTION_END }; return (GNUNET_OK == -- 2.25.1