From 9a51540b1584d480f710ac8cff1218e77c6cdd62 Mon Sep 17 00:00:00 2001 From: "\"Vladimir N. Oleynik\"" Date: Wed, 15 Feb 2006 13:27:18 +0000 Subject: [PATCH] demo (UN)USE_FEATURE... usage --- networking/httpd.c | 109 +++++++++++++++++++-------------------------- 1 file changed, 45 insertions(+), 64 deletions(-) diff --git a/networking/httpd.c b/networking/httpd.c index 99a87d186..9c8cbb05f 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -240,16 +240,12 @@ typedef struct { char buf[MAX_MEMORY_BUFF]; -#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH - const char *realm; - char *remoteuser; -#endif + USE_FEATURE_HTTPD_BASIC_AUTH(const char *realm;) + USE_FEATURE_HTTPD_BASIC_AUTH(char *remoteuser;) const char *query; -#ifdef CONFIG_FEATURE_HTTPD_CGI - char *referer; -#endif + USE_FEATURE_HTTPD_CGI(char *referer;) const char *configFile; @@ -1991,39 +1987,42 @@ static void sighup_handler(int sig) } #endif +enum httpd_opts_nums { + c_opt_config_file = 0, + d_opt_decode_url, + h_opt_home_httpd, + USE_FEATURE_HTTPD_ENCODE_URL_STR(e_opt_encode_url,) + USE_FEATURE_HTTPD_BASIC_AUTH(r_opt_realm,) + USE_FEATURE_HTTPD_AUTH_MD5(m_opt_md5,) + USE_FEATURE_HTTPD_SETUID(u_opt_setuid,) + UNUSE_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY(p_opt_port,) +}; static const char httpd_opts[]="c:d:h:" -#ifdef CONFIG_FEATURE_HTTPD_ENCODE_URL_STR - "e:" -#endif -#define OPT_INC_1 ENABLE_FEATURE_HTTPD_ENCODE_URL_STR + USE_FEATURE_HTTPD_ENCODE_URL_STR("e:") + USE_FEATURE_HTTPD_BASIC_AUTH("r:") + USE_FEATURE_HTTPD_AUTH_MD5("m:") + USE_FEATURE_HTTPD_SETUID("u:") + UNUSE_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY("p:"); -#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH - "r:" -#endif -#define OPT_INC_2 ENABLE_FEATURE_HTTPD_BASIC_AUTH +#define OPT_CONFIG_FILE (1<configFile), &url_for_decode, &home_httpd -#ifdef CONFIG_FEATURE_HTTPD_ENCODE_URL_STR - , &url_for_encode -#endif -#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH - , &(config->realm) -# ifdef CONFIG_FEATURE_HTTPD_AUTH_MD5 - , &pass -# endif -#endif -#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY - , &s_port -#endif -#ifdef CONFIG_FEATURE_HTTPD_SETUID - , &s_uid -#endif - ); + USE_FEATURE_HTTPD_ENCODE_URL_STR(, &url_for_encode) + USE_FEATURE_HTTPD_BASIC_AUTH(, &(config->realm)) + USE_FEATURE_HTTPD_AUTH_MD5(, &pass) + USE_FEATURE_HTTPD_SETUID(, &s_uid) + UNUSE_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY(, &s_port) + ); if(opt & OPT_DECODE_URL) { printf("%s", decodeString(url_for_decode, 1));