aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-bcd.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-06-04 19:00:10 +0200
committerChristian Grothoff <christian@grothoff.org>2018-06-04 19:00:10 +0200
commit41cbe10b783a0741c75566232886f262cd779fbb (patch)
tree044c6277532cd0ade440915982a86745623da7a5 /src/gns/gnunet-bcd.c
parentfdf5283f5d5d603217748232941bafb60728aeb2 (diff)
downloadgnunet-41cbe10b783a0741c75566232886f262cd779fbb.tar.gz
gnunet-41cbe10b783a0741c75566232886f262cd779fbb.zip
add function for getopt uint16_t arguments
Diffstat (limited to 'src/gns/gnunet-bcd.c')
-rw-r--r--src/gns/gnunet-bcd.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c
index 0746d5c57..d7fd1a812 100644
--- a/src/gns/gnunet-bcd.c
+++ b/src/gns/gnunet-bcd.c
@@ -76,7 +76,7 @@ static char *resfile;
76/** 76/**
77 * Port number. 77 * Port number.
78 */ 78 */
79static unsigned int port = 8888; 79static uint16_t port = 8888;
80 80
81 81
82struct Entry 82struct Entry
@@ -351,7 +351,7 @@ prepare_daemon (struct MHD_Daemon *daemon_handle)
351static int 351static int
352server_start () 352server_start ()
353{ 353{
354 if ((0 == port) || (port > UINT16_MAX)) 354 if (0 == port)
355 { 355 {
356 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 356 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
357 _("Invalid port number %u. Exiting.\n"), 357 _("Invalid port number %u. Exiting.\n"),
@@ -362,7 +362,7 @@ server_start ()
362 _("Businesscard HTTP server starts on %u\n"), 362 _("Businesscard HTTP server starts on %u\n"),
363 port); 363 port);
364 daemon_handle = MHD_start_daemon (MHD_USE_DUAL_STACK | MHD_USE_DEBUG, 364 daemon_handle = MHD_start_daemon (MHD_USE_DUAL_STACK | MHD_USE_DEBUG,
365 (uint16_t) port, 365 port,
366 NULL /* accept_policy_callback */, NULL, 366 NULL /* accept_policy_callback */, NULL,
367 &access_handler_callback, NULL, 367 &access_handler_callback, NULL,
368 MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 512, 368 MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 512,
@@ -374,7 +374,7 @@ server_start ()
374 { 374 {
375 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 375 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
376 _("Could not start businesscard HTTP server on port %u\n"), 376 _("Could not start businesscard HTTP server on port %u\n"),
377 (unsigned short) port); 377 (unsigned int) port);
378 return GNUNET_SYSERR; 378 return GNUNET_SYSERR;
379 } 379 }
380 http_task = prepare_daemon (daemon_handle); 380 http_task = prepare_daemon (daemon_handle);
@@ -516,17 +516,17 @@ main (int argc, char *const *argv)
516{ 516{
517 struct GNUNET_GETOPT_CommandLineOption options[] = { 517 struct GNUNET_GETOPT_CommandLineOption options[] = {
518 518
519 GNUNET_GETOPT_option_uint ('p', 519 GNUNET_GETOPT_option_uint16 ('p',
520 "port", 520 "port",
521 "PORT", 521 "PORT",
522 gettext_noop ("Run HTTP serve on port PORT (default is 8888)"), 522 gettext_noop ("Run HTTP serve on port PORT (default is 8888)"),
523 &port), 523 &port),
524
525 GNUNET_GETOPT_OPTION_END 524 GNUNET_GETOPT_OPTION_END
526 }; 525 };
527 int ret; 526 int ret;
528 527
529 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 528 if (GNUNET_OK !=
529 GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
530 return 2; 530 return 2;
531 GNUNET_log_setup ("gnunet-bcd", "WARNING", NULL); 531 GNUNET_log_setup ("gnunet-bcd", "WARNING", NULL);
532 ret = 532 ret =