From 080f6519a4fa299e19d51516a4af3e16f28abc26 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 28 Mar 2009 12:45:28 +0000 Subject: Fix problem in conditional compilation git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1647 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/netutils/webserver/httpd_cgi.c | 47 ++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 10 deletions(-) (limited to 'nuttx') diff --git a/nuttx/netutils/webserver/httpd_cgi.c b/nuttx/netutils/webserver/httpd_cgi.c index d8a7523f8..a51a4e273 100644 --- a/nuttx/netutils/webserver/httpd_cgi.c +++ b/nuttx/netutils/webserver/httpd_cgi.c @@ -51,11 +51,26 @@ * Pre-processor Definitions ****************************************************************************/ +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static void nullfunction(struct httpd_state *pstate, char *ptr); +#ifdef CONFIG_NETUTILS_HTTPDNETSTATS +static void net_stats(struct httpd_state *pstate, char *ptr); +#endif + +#ifdef CONFIG_NETUTILS_HTTPDFILESTATS +static void file_stats(struct httpd_state *pstate, char *ptr); +#endif + /**************************************************************************** * Private Data ****************************************************************************/ +#ifdef CONFIG_NETUTILS_HTTPDFILESTATS HTTPD_CGI_CALL(file, "file-stats", file_stats); +#endif #ifdef CONFIG_NETUTILS_HTTPDNETSTATS HTTPD_CGI_CALL(net, "net-stats", net_stats); #endif @@ -94,10 +109,18 @@ static const char last_ack[] = /* "LAST-ACK"*/ * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: nullfunction + ****************************************************************************/ + static void nullfunction(struct httpd_state *pstate, char *ptr) { } +/**************************************************************************** + * Name: net_stats + ****************************************************************************/ + #ifdef CONFIG_NETUTILS_HTTPDNETSTATS static void net_stats(struct httpd_state *pstate, char *ptr) { @@ -112,6 +135,20 @@ static void net_stats(struct httpd_state *pstate, char *ptr) } #endif +/**************************************************************************** + * Name: file_stats + ****************************************************************************/ + +#ifdef CONFIG_NETUTILS_HTTPDFILESTATS +static void file_stats(struct httpd_state *pstate, char *ptr) +{ + char buffer[16]; + char *pcount = strchr(ptr, ' ') + 1; + snprintf(buffer, 16, "%5u", httpd_fs_count(pcount)); + (void)send(pstate->ht_sockfd, buffer, strlen(buffer), 0); +} +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -131,13 +168,3 @@ httpd_cgifunction httpd_cgi(char *name) } return nullfunction; } - -#ifdef CONFIG_NETUTILS_HTTPDFILESTATS -static void file_stats(struct httpd_state *pstate, char *ptr) -{ - char buffer[16]; - char *pcount = strchr(ptr, ' ') + 1; - snprintf(buffer, 16, "%5u", httpd_fs_count(pcount)); - (void)send(pstate->ht_sockfd, buffer, strlen(buffer), 0); -} -#endif -- cgit v1.2.3