gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r7553 - in libmicrohttpd/doc: . examples
Date: Thu, 14 Aug 2008 07:00:44 -0600 (MDT)

Author: sebdocwriter
Date: 2008-08-14 07:00:44 -0600 (Thu, 14 Aug 2008)
New Revision: 7553

Modified:
   libmicrohttpd/doc/examples/logging.c
   libmicrohttpd/doc/exploringrequests.inc
Log:
improved adherence to GNU coding standards (logging-example)


Modified: libmicrohttpd/doc/examples/logging.c
===================================================================
--- libmicrohttpd/doc/examples/logging.c        2008-08-14 12:41:46 UTC (rev 
7552)
+++ libmicrohttpd/doc/examples/logging.c        2008-08-14 13:00:44 UTC (rev 
7553)
@@ -6,20 +6,19 @@
 #define PORT 8888
 
 
-int PrintOutKey(void *cls, enum MHD_ValueKind kind, const char *key, const 
char *value)
+int print_out_key (void *cls, enum MHD_ValueKind kind, const char *key, const 
char *value)
 {
-  printf("%s = %s\n", key, value);
+  printf ("%s = %s\n", key, value);
   return MHD_YES;
 }
 
-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)
 {
-  
-  printf("New request %s for %s using version %s\n", method, url, version);
+  printf ("New request %s for %s using version %s\n", method, url, version);
 
-  MHD_get_connection_values(connection, MHD_HEADER_KIND, PrintOutKey, NULL);
+  MHD_get_connection_values (connection, MHD_HEADER_KIND, print_out_key, NULL);
 
   return MHD_NO;
 }
@@ -28,12 +27,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/exploringrequests.inc
===================================================================
--- libmicrohttpd/doc/exploringrequests.inc     2008-08-14 12:41:46 UTC (rev 
7552)
+++ libmicrohttpd/doc/exploringrequests.inc     2008-08-14 13:00:44 UTC (rev 
7553)
@@ -9,9 +9,9 @@
 without much ado by the server.
 
 @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)
 {
   ...  
   return MHD_NO;
@@ -27,7 +27,7 @@
 To call it a "new request" is justified because we return only @code{MHD_NO}, 
thus ensuring the 
 function will not be called again for this connection. 
 @verbatim
-printf("New request %s for %s using version %s\n", method, url, version);
+printf ("New request %s for %s using version %s\n", method, url, version);
 @end verbatim
 @noindent
 
@@ -38,10 +38,9 @@
 each pair just like the above function is called for each HTTP request. 
 It can then print out the content of this pair.
 @verbatim
-int PrintOutKey(void *cls, enum MHD_ValueKind kind, const char *key, 
-    const char *value)
+int print_out_key (void *cls, enum MHD_ValueKind kind, const char *key, const 
char *value)
 {
-  printf("%s = %s\n", key, value);
+  printf ("%s = %s\n", key, value);
   return MHD_YES;
 }
 @end verbatim
@@ -49,7 +48,7 @@
 
 To start the iteration process that calls our new function for every key, the 
line
 @verbatim
-MHD_get_connection_values(connection, MHD_HEADER_KIND, PrintOutKey, NULL);
+MHD_get_connection_values (connection, MHD_HEADER_KIND, print_out_key, NULL);
 @end verbatim
 @noindent
 needs to be inserted in the connection callback function too. The second 
parameter tells the function 
@@ -89,8 +88,8 @@
 A very interesting information has still been ignored by our logger---the 
client's IP address. 
 Implement a callback function 
 @verbatim
-int OnClientConnect(void *cls,
-                    const struct sockaddr *addr,socklen_t addrlen)
+int on_client_connect (void *cls,
+                       const struct sockaddr *addr,socklen_t addrlen)
 @end verbatim
 @noindent
 that prints out the IP address in an appropriate format. You might want to use 
the posix function





reply via email to

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