gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r7551 - in libmicrohttpd/doc: . examples


From: gnunet
Subject: [GNUnet-SVN] r7551 - in libmicrohttpd/doc: . examples
Date: Wed, 13 Aug 2008 16:04:28 -0600 (MDT)

Author: sebdocwriter
Date: 2008-08-13 16:04:28 -0600 (Wed, 13 Aug 2008)
New Revision: 7551

Modified:
   libmicrohttpd/doc/examples/hellobrowser.c
   libmicrohttpd/doc/hellobrowser.inc
Log:
improved adherence to GNU coding standards (Hello, Browser-example)


Modified: libmicrohttpd/doc/examples/hellobrowser.c
===================================================================
--- libmicrohttpd/doc/examples/hellobrowser.c   2008-08-13 18:43:54 UTC (rev 
7550)
+++ libmicrohttpd/doc/examples/hellobrowser.c   2008-08-13 22:04:28 UTC (rev 
7551)
@@ -5,9 +5,9 @@
 
 #define PORT 8888
 
-int AnswerToConnection(void *cls, struct MHD_Connection *connection, const 
char *url, 
-    const char *method, const char *version, const char *upload_data, 
-    unsigned int *upload_data_size, void **con_cls)
+int answer_to_connection (void *cls, struct MHD_Connection *connection, const 
char *url, 
+                          const char *method, const char *version, const char 
*upload_data, 
+                          unsigned int *upload_data_size, void **con_cls)
 {
   const char *page  = "<html><body>Hello, browser!</body></html>";
   struct MHD_Response *response;
@@ -16,6 +16,7 @@
   response = MHD_create_response_from_data (strlen (page), (void*) page, 
MHD_NO, MHD_NO);
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
   MHD_destroy_response (response);
+
   return ret;
 }
 
@@ -23,12 +24,12 @@
 {
   struct MHD_Daemon *daemon;
 
-  daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, 
-                            &AnswerToConnection, NULL, MHD_OPTION_END);
-  if (daemon == NULL) return 1;
+  daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, 
+                             &answer_to_connection, NULL, MHD_OPTION_END);
+  if (NULL == daemon) return 1;
 
-  getchar(); 
+  getchar (); 
 
-  MHD_stop_daemon(daemon);
+  MHD_stop_daemon (daemon);
   return 0;
 }

Modified: libmicrohttpd/doc/hellobrowser.inc
===================================================================
--- libmicrohttpd/doc/hellobrowser.inc  2008-08-13 18:43:54 UTC (rev 7550)
+++ libmicrohttpd/doc/hellobrowser.inc  2008-08-13 22:04:28 UTC (rev 7551)
@@ -35,9 +35,9 @@
 
 Talking about the reply, it is defined as a string right after the function 
header
 @verbatim
-int AnswerToConnection(void *cls, struct MHD_Connection *connection, 
-    const char *url, const char *method, const char *version,
-    const char *upload_data, unsigned int *upload_data_size, void **con_cls)
+int answer_to_connection (void *cls, struct MHD_Connection *connection, const 
char *url, 
+                          const char *method, const char *version, const char 
*upload_data, 
+                          unsigned int *upload_data_size, void **con_cls)
 {
   const char *page  = "<html><body>Hello, browser!</body></html>";
 @end verbatim
@@ -55,8 +55,8 @@
   struct MHD_Response *response;
   int ret;
 
-  response = MHD_create_response_from_data(strlen(page),
-             (void*)page, MHD_NO, MHD_NO);
+  response = MHD_create_response_from_data (strlen (page),
+                                            (void*) page, MHD_NO, MHD_NO);
 @end verbatim
 @noindent
 Now that the the response has been laced up, it is ready for delivery and can 
be queued for sending. 
@@ -72,6 +72,7 @@
 @verbatim
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
   MHD_destroy_response (response);
+
   return ret;
 }
 @end verbatim
@@ -81,11 +82,11 @@
 @verbatim
 int main ()
 {
-  struct MHD_Daemon *d;
+  struct MHD_Daemon *daemon;
 
-  d = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, 
-                      &AnswerToConnection, NULL, MHD_OPTION_END);
-  if (d == NULL) return 1;
+  daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, 
+                             &answer_to_connection, NULL, MHD_OPTION_END);
+  if (NULL == daemon) return 1;
 @end verbatim
 @noindent
 The first parameter is one of three possible modes of operation. Here we want 
the daemon to run in
@@ -107,11 +108,12 @@
 friendly manner by waiting for the enter key to be pressed. In the end, we 
stop the daemon so it can
 do its cleanup tasks.
 @verbatim
-  getchar(); 
+  getchar (); 
 
-  MHD_stop_daemon(d);
+  MHD_stop_daemon (daemon);
   return 0;
 }
+
 @end verbatim
 @noindent
 The first example is now complete.





reply via email to

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