summaryrefslogtreecommitdiffstats
path: root/modules/echo/mod_echo.c
diff options
context:
space:
mode:
authorKen Coar <coar@apache.org>2001-01-09 23:55:13 +0100
committerKen Coar <coar@apache.org>2001-01-09 23:55:13 +0100
commit322f19da6b7e48477945b7fd1f82008f9b4651be (patch)
tree506f4fbd06c175e7eaeeb49c21ebc11e061e84b1 /modules/echo/mod_echo.c
parent Minor typo fix. (diff)
downloadapache2-322f19da6b7e48477945b7fd1f82008f9b4651be.tar.xz
apache2-322f19da6b7e48477945b7fd1f82008f9b4651be.zip
This sets an example for this type of module, so let's make sure
it uses our own guidelines. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87636 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/echo/mod_echo.c')
-rw-r--r--modules/echo/mod_echo.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/modules/echo/mod_echo.c b/modules/echo/mod_echo.c
index c1faf3f32e..8e4d764a02 100644
--- a/modules/echo/mod_echo.c
+++ b/modules/echo/mod_echo.c
@@ -64,52 +64,53 @@
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 = {