summaryrefslogtreecommitdiff
path: root/src/nse/gnunet-nse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nse/gnunet-nse.c')
-rw-r--r--src/nse/gnunet-nse.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/nse/gnunet-nse.c b/src/nse/gnunet-nse.c
index 3735373b5..edb73c0fc 100644
--- a/src/nse/gnunet-nse.c
+++ b/src/nse/gnunet-nse.c
@@ -44,14 +44,14 @@ static int status;
44 * @param cls NULL 44 * @param cls NULL
45 */ 45 */
46static void 46static void
47do_shutdown(void *cls) 47do_shutdown (void *cls)
48{ 48{
49 (void)cls; 49 (void) cls;
50 if (NULL != nse) 50 if (NULL != nse)
51 { 51 {
52 GNUNET_NSE_disconnect(nse); 52 GNUNET_NSE_disconnect (nse);
53 nse = NULL; 53 nse = NULL;
54 } 54 }
55} 55}
56 56
57 57
@@ -65,19 +65,19 @@ do_shutdown(void *cls)
65 * of the size estimation values seen 65 * of the size estimation values seen
66 */ 66 */
67static void 67static void
68handle_estimate(void *cls, 68handle_estimate (void *cls,
69 struct GNUNET_TIME_Absolute timestamp, 69 struct GNUNET_TIME_Absolute timestamp,
70 double estimate, 70 double estimate,
71 double std_dev) 71 double std_dev)
72{ 72{
73 (void)cls; 73 (void) cls;
74 status = 0; 74 status = 0;
75 fprintf(stdout, 75 fprintf (stdout,
76 "%llu %f %f %f\n", 76 "%llu %f %f %f\n",
77 (unsigned long long)timestamp.abs_value_us, 77 (unsigned long long) timestamp.abs_value_us,
78 GNUNET_NSE_log_estimate_to_n(estimate), 78 GNUNET_NSE_log_estimate_to_n (estimate),
79 estimate, 79 estimate,
80 std_dev); 80 std_dev);
81} 81}
82 82
83 83
@@ -90,16 +90,16 @@ handle_estimate(void *cls,
90 * @param cfg configuration handle 90 * @param cfg configuration handle
91 */ 91 */
92static void 92static void
93run(void *cls, 93run (void *cls,
94 char *const *args, 94 char *const *args,
95 const char *cfgfile, 95 const char *cfgfile,
96 const struct GNUNET_CONFIGURATION_Handle *cfg) 96 const struct GNUNET_CONFIGURATION_Handle *cfg)
97{ 97{
98 (void)cls; 98 (void) cls;
99 (void)args; 99 (void) args;
100 (void)cfgfile; 100 (void) cfgfile;
101 nse = GNUNET_NSE_connect(cfg, &handle_estimate, NULL); 101 nse = GNUNET_NSE_connect (cfg, &handle_estimate, NULL);
102 GNUNET_SCHEDULER_add_shutdown(&do_shutdown, NULL); 102 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
103} 103}
104 104
105 105
@@ -109,7 +109,7 @@ run(void *cls,
109 * @return 0 on success 109 * @return 0 on success
110 */ 110 */
111int 111int
112main(int argc, char *const *argv) 112main (int argc, char *const *argv)
113{ 113{
114 static struct GNUNET_GETOPT_CommandLineOption options[] = { 114 static struct GNUNET_GETOPT_CommandLineOption options[] = {
115 GNUNET_GETOPT_OPTION_END 115 GNUNET_GETOPT_OPTION_END
@@ -117,14 +117,14 @@ main(int argc, char *const *argv)
117 117
118 status = 1; 118 status = 1;
119 if (GNUNET_OK != 119 if (GNUNET_OK !=
120 GNUNET_PROGRAM_run(argc, 120 GNUNET_PROGRAM_run (argc,
121 argv, 121 argv,
122 "gnunet-nse", 122 "gnunet-nse",
123 gettext_noop( 123 gettext_noop (
124 "Show network size estimates from NSE service."), 124 "Show network size estimates from NSE service."),
125 options, 125 options,
126 &run, 126 &run,
127 NULL)) 127 NULL))
128 return 2; 128 return 2;
129 return status; 129 return status;
130} 130}