aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2024-02-26 11:02:10 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2024-02-26 11:02:10 +0100
commit3d1f1f49d41855f23a4943c83dd7cfec7c0c2f34 (patch)
tree66516016ce3b6077e87c644ccf766364daa8d04c /src
parent6a5b821f68b595dd6bd3355c417a12abff137b41 (diff)
downloadgnunet-3d1f1f49d41855f23a4943c83dd7cfec7c0c2f34.tar.gz
gnunet-3d1f1f49d41855f23a4943c83dd7cfec7c0c2f34.zip
CORE: Improve information provided through CLI
Diffstat (limited to 'src')
-rw-r--r--src/cli/core/gnunet-core.c42
1 files changed, 35 insertions, 7 deletions
diff --git a/src/cli/core/gnunet-core.c b/src/cli/core/gnunet-core.c
index c7aef5349..9d6eccb81 100644
--- a/src/cli/core/gnunet-core.c
+++ b/src/cli/core/gnunet-core.c
@@ -34,6 +34,16 @@
34static int monitor_connections; 34static int monitor_connections;
35 35
36/** 36/**
37 * Option -i.
38 */
39static int show_pid;
40
41/**
42 * Option -s.
43 */
44static int show_conns;
45
46/**
37 * Handle to the CORE monitor. 47 * Handle to the CORE monitor.
38 */ 48 */
39static struct GNUNET_CORE_MonitorHandle *mh; 49static struct GNUNET_CORE_MonitorHandle *mh;
@@ -184,14 +194,18 @@ run (void *cls,
184 return; 194 return;
185 } 195 }
186 GNUNET_CRYPTO_eddsa_key_get_public (&pk, &pub); 196 GNUNET_CRYPTO_eddsa_key_get_public (&pk, &pub);
187 fprintf (stdout, 197 if (show_pid)
188 _ ("Local peer: %s\n\n"), 198 fprintf (stdout,
189 GNUNET_i2s ((struct GNUNET_PeerIdentity*) &pub)); 199 _ ("Current local peer identity: %s\n"),
190 mh = GNUNET_CORE_monitor_start (cfg, &monitor_cb, NULL); 200 GNUNET_i2s_full ((struct GNUNET_PeerIdentity*) &pub));
191 if (NULL == mh) 201 if (show_conns || monitor_connections)
192 { 202 {
193 fprintf (stderr, "%s", _ ("Failed to connect to CORE service!\n")); 203 mh = GNUNET_CORE_monitor_start (cfg, &monitor_cb, NULL);
194 return; 204 if (NULL == mh)
205 {
206 fprintf (stderr, "%s", _ ("Failed to connect to CORE service!\n"));
207 return;
208 }
195 } 209 }
196 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); 210 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
197} 211}
@@ -215,6 +229,20 @@ main (int argc, char *const *argv)
215 gettext_noop ( 229 gettext_noop (
216 "provide information about all current connections (continuously)"), 230 "provide information about all current connections (continuously)"),
217 &monitor_connections), 231 &monitor_connections),
232 GNUNET_GETOPT_option_flag (
233 'i',
234 "show-identity",
235 gettext_noop (
236 "Show our current peer identity"
237 ),
238 &show_pid),
239 GNUNET_GETOPT_option_flag (
240 's',
241 "connection-status",
242 gettext_noop (
243 "Show current connections"
244 ),
245 &show_conns),
218 GNUNET_GETOPT_OPTION_END }; 246 GNUNET_GETOPT_OPTION_END };
219 247
220 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 248 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))