diff options
author | nevans <nevans@140774ce-b5e7-0310-ab8b-a85725594a96> | 2010-04-01 08:13:38 +0000 |
---|---|---|
committer | nevans <nevans@140774ce-b5e7-0310-ab8b-a85725594a96> | 2010-04-01 08:13:38 +0000 |
commit | 02464ecd39db9f43735c1be47ceec419ae6d13ae (patch) | |
tree | b43b20a4ad0f1d8aa585f78b83437cc6de4ef834 /src/arm/gnunet-arm.c | |
parent | 21b8ed7ebeba472b3eeaa0432a925555c00489fb (diff) |
add quiet flag (fix for test case)
git-svn-id: https://gnunet.org/svn/gnunet@10732 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/arm/gnunet-arm.c')
-rw-r--r-- | src/arm/gnunet-arm.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c index dd75d32845..2b438b30d6 100644 --- a/src/arm/gnunet-arm.c +++ b/src/arm/gnunet-arm.c @@ -51,6 +51,11 @@ static int start; static int delete; /** + * Set if we should not print status messages. + */ +static int quiet; + +/** * Set to the name of a service to start. */ static char *init; @@ -127,14 +132,17 @@ confirm_cb (void *cls, int success) switch (success) { case GNUNET_OK: - GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Service `%s' is now running.\n"), service); + if (quiet != GNUNET_YES) + fprintf(stdout, _("Service `%s' is now running.\n"), service); break; case GNUNET_NO: - GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Service `%s' is not running.\n"), service); + if (quiet != GNUNET_YES) + fprintf(stdout, _("Service `%s' is not running.\n"), service); break; case GNUNET_SYSERR: - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - _("Error updating service `%s': ARM not running\n"), service); + if (quiet != GNUNET_YES) + fprintf(stdout, + _("Error updating service `%s': ARM not running\n"), service); break; } GNUNET_SCHEDULER_add_continuation (sched, @@ -157,9 +165,15 @@ confirm_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) const char *service = cls; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) - GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Service `%s' is running.\n"), service); + { + if (quiet != GNUNET_YES) + fprintf(stdout, _("Service `%s' is running.\n"), service); + } else - GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Service `%s' is not running.\n"), service); + { + if (quiet != GNUNET_YES) + fprintf(stdout, _("Service `%s' is not running.\n"), service); + } GNUNET_SCHEDULER_add_continuation (sched, &cps_loop, NULL, @@ -305,6 +319,8 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = { GNUNET_YES, &GNUNET_GETOPT_set_string, &test}, {'d', "delete", NULL, gettext_noop ("delete config file and directory on exit"), GNUNET_NO, &GNUNET_GETOPT_set_one, &delete}, + {'q', "quiet", NULL, gettext_noop ("don't print status messages"), + GNUNET_NO, &GNUNET_GETOPT_set_one, &quiet}, GNUNET_GETOPT_OPTION_END }; |