2 This file is part of GNUnet.
3 (C) 2013 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 * @file identity/gnunet-identity.c
22 * @brief IDENTITY monitoring command line tool
23 * @author Christian Grothoff
26 #include "gnunet_util_lib.h"
27 #include "gnunet_identity_service.h"
30 * Handle to IDENTITY service.
32 static struct GNUNET_IDENTITY_Handle *sh;
35 * Was verbose specified?
41 * Task run on shutdown.
47 shutdown_task (void *cls,
48 const struct GNUNET_SCHEDULER_TaskContext *tc)
50 GNUNET_IDENTITY_disconnect (sh);
56 * Main function that will be run by the scheduler.
59 * @param args remaining command-line arguments
60 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
61 * @param cfg configuration
64 run (void *cls, char *const *args, const char *cfgfile,
65 const struct GNUNET_CONFIGURATION_Handle *cfg)
67 sh = GNUNET_IDENTITY_connect (cfg, NULL, NULL);
68 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
69 &shutdown_task, NULL);
76 * @param argc number of arguments from the command line
77 * @param argv command line arguments
78 * @return 0 ok, 1 on error
81 main (int argc, char *const *argv)
85 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
86 {'V', "verbose", NULL,
87 gettext_noop ("verbose output"),
88 0, &GNUNET_GETOPT_set_one, &verbose},
89 GNUNET_GETOPT_OPTION_END
92 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
95 res = GNUNET_PROGRAM_run (argc, argv, "gnunet-identity",
96 gettext_noop ("Print information about IDENTITY state"),
99 GNUNET_free ((void *) argv);
101 if (GNUNET_OK != res)
106 /* end of gnunet-identity.c */