aboutsummaryrefslogtreecommitdiff
path: root/src/examples/querystring_example.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/querystring_example.c')
-rw-r--r--src/examples/querystring_example.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/examples/querystring_example.c b/src/examples/querystring_example.c
index 3d91bcea..db0d6f1a 100644
--- a/src/examples/querystring_example.c
+++ b/src/examples/querystring_example.c
@@ -77,16 +77,24 @@ int
77main (int argc, char *const *argv) 77main (int argc, char *const *argv)
78{ 78{
79 struct MHD_Daemon *d; 79 struct MHD_Daemon *d;
80 int port;
80 81
81 if (argc != 2) 82 if (argc != 2)
82 { 83 {
83 printf ("%s PORT\n", argv[0]); 84 printf ("%s PORT\n", argv[0]);
84 return 1; 85 return 1;
85 } 86 }
87 port = atoi (argv[1]);
88 if ( (port < 0) ||
89 (port > UINT16_MAX) )
90 {
91 printf ("%s PORT\n", argv[0]);
92 return 1;
93 }
86 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 94 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
87 atoi (argv[1]), 95 (uint16_t) port,
88 NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_END); 96 NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_END);
89 if (d == NULL) 97 if (NULL == d)
90 return 1; 98 return 1;
91 (void) getc (stdin); 99 (void) getc (stdin);
92 MHD_stop_daemon (d); 100 MHD_stop_daemon (d);