gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r36830 - libmicrohttpd/src/examples


From: gnunet
Subject: [GNUnet-SVN] r36830 - libmicrohttpd/src/examples
Date: Mon, 18 Jan 2016 21:37:15 +0100

Author: grothoff
Date: 2016-01-18 21:37:15 +0100 (Mon, 18 Jan 2016)
New Revision: 36830

Modified:
   libmicrohttpd/src/examples/authorization_example.c
   libmicrohttpd/src/examples/demo.c
Log:
use getc() as in demo.c instead of sleep()

Modified: libmicrohttpd/src/examples/authorization_example.c
===================================================================
--- libmicrohttpd/src/examples/authorization_example.c  2016-01-18 20:30:54 UTC 
(rev 36829)
+++ libmicrohttpd/src/examples/authorization_example.c  2016-01-18 20:37:15 UTC 
(rev 36830)
@@ -90,22 +90,29 @@
   return ret;
 }
 
+
 int
 main (int argc, char *const *argv)
 {
   struct MHD_Daemon *d;
+  unsigned int port;
 
-  if (argc != 3)
+  if ( (argc != 2) ||
+       (1 != sscanf (argv[1], "%u", &port)) ||
+       (UINT16_MAX < port) )
     {
-      printf ("%s PORT SECONDS-TO-RUN\n", argv[0]);
+      fprintf (stderr,
+              "%s PORT\n", argv[0]);
       return 1;
     }
+
   d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG,
                         atoi (argv[1]),
                         NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_END);
   if (d == NULL)
     return 1;
-  sleep (atoi (argv[2]));
+  fprintf (stderr, "HTTP server running. Press ENTER to stop the server\n");
+  (void) getc (stdin);
   MHD_stop_daemon (d);
   return 0;
 }

Modified: libmicrohttpd/src/examples/demo.c
===================================================================
--- libmicrohttpd/src/examples/demo.c   2016-01-18 20:30:54 UTC (rev 36829)
+++ libmicrohttpd/src/examples/demo.c   2016-01-18 20:37:15 UTC (rev 36830)
@@ -856,9 +856,9 @@
               "%s PORT\n", argv[0]);
       return 1;
     }
-  #ifndef MINGW
+#ifndef MINGW
   ignore_sigpipe ();
-  #endif
+#endif
   magic = magic_open (MAGIC_MIME_TYPE);
   (void) magic_load (magic, NULL);
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]