]> granicus.if.org Git - apache/commitdiff
This sets an example for this type of module, so let's make sure
authorKen Coar <coar@apache.org>
Tue, 9 Jan 2001 22:55:13 +0000 (22:55 +0000)
committerKen Coar <coar@apache.org>
Tue, 9 Jan 2001 22:55:13 +0000 (22:55 +0000)
it uses our own guidelines.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87636 13f79535-47bb-0310-9956-ffa450edef68

modules/echo/mod_echo.c

index c1faf3f32e6209a1b8896969b31d0919125006b5..8e4d764a02ae301ffe0b253ea93972c00576edb2 100644 (file)
 
 AP_DECLARE_DATA module echo_module;
 
-typedef struct
-    {
+typedef struct {
     int bEnabled;
-    } EchoConfig;
+} EchoConfig;
 
-static void *create_echo_server_config(apr_pool_t *p,server_rec *s)
-    {
-    EchoConfig *pConfig=apr_pcalloc(p,sizeof *pConfig);
+static void *create_echo_server_config(apr_pool_t *p, server_rec *s)
+{
+    EchoConfig *pConfig = apr_pcalloc(p, sizeof *pConfig);
 
-    pConfig->bEnabled=0;
+    pConfig->bEnabled = 0;
 
     return pConfig;
-    }
+}
 
 static const char *echo_on(cmd_parms *cmd, void *dummy, int arg)
-    {
-    EchoConfig *pConfig=ap_get_module_config(cmd->server->module_config,
-                                            &echo_module);
-    pConfig->bEnabled=arg;
+{
+    EchoConfig *pConfig = ap_get_module_config(cmd->server->module_config,
+                                               &echo_module);
+    pConfig->bEnabled = arg;
 
     return NULL;
-    }
+}
 
 static int process_echo_connection(conn_rec *c)
-    {
+{
     char buf[1024];
-    EchoConfig *pConfig=ap_get_module_config(c->base_server->module_config,
-                                            &echo_module);
+    EchoConfig *pConfig = ap_get_module_config(c->base_server->module_config,
+                                               &echo_module);
 
-    if(!pConfig->bEnabled)
-       return DECLINED;
+    if (!pConfig->bEnabled) {
+        return DECLINED;
+    }
 
-    for( ; ; )
-       {
+    for ( ; ; ) {
        apr_ssize_t r, w;
         r = sizeof(buf);
         apr_recv(c->client_socket, buf, &r);
-       if(r <= 0)
-           break;
+       if (r <= 0) {
+            break;
+        }
         w = r;
        apr_send(c->client_socket, buf, &w);
-       if(w != r)
+       if (w != r) {
            break;
-       }
-    return OK;
+        }
     }
+    return OK;
+}
 
 static const command_rec echo_cmds[] = 
 {
@@ -120,7 +121,8 @@ static const command_rec echo_cmds[] =
 
 static void register_hooks(void)
 {
-    ap_hook_process_connection(process_echo_connection,NULL,NULL,AP_HOOK_MIDDLE);
+    ap_hook_process_connection(process_echo_connection, NULL, NULL,
+                               AP_HOOK_MIDDLE);
 }
 
 AP_DECLARE_DATA module echo_module = {