conf: use cpp stringification for STDCONF macro
This commit is contained in:
		
							parent
							
								
									551e914d24
								
							
						
					
					
						commit
						880a8b0ab6
					
				
							
								
								
									
										80
									
								
								src/conf.c
									
									
									
									
									
								
							
							
						
						
									
										80
									
								
								src/conf.c
									
									
									
									
									
								
							@ -177,7 +177,7 @@ static void config_free_regex (void);
 | 
				
			|||||||
 * do not follow the pattern above.  This macro is for convenience
 | 
					 * do not follow the pattern above.  This macro is for convenience
 | 
				
			||||||
 * only.
 | 
					 * only.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#define STDCONF(d, re, func) { BEGIN "(" d ")" WS re END, func, NULL }
 | 
					#define STDCONF(d, re, func) { BEGIN "(" #d ")" WS re END, func, NULL }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Holds the regular expression used to match the configuration directive,
 | 
					 * Holds the regular expression used to match the configuration directive,
 | 
				
			||||||
@ -199,59 +199,59 @@ struct {
 | 
				
			|||||||
                "^[[:space:]]+$", handle_nop, NULL
 | 
					                "^[[:space:]]+$", handle_nop, NULL
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        /* string arguments */
 | 
					        /* string arguments */
 | 
				
			||||||
        STDCONF ("logfile", STR, handle_logfile),
 | 
					        STDCONF (logfile, STR, handle_logfile),
 | 
				
			||||||
        STDCONF ("pidfile", STR, handle_pidfile),
 | 
					        STDCONF (pidfile, STR, handle_pidfile),
 | 
				
			||||||
        STDCONF ("anonymous", STR, handle_anonymous),
 | 
					        STDCONF (anonymous, STR, handle_anonymous),
 | 
				
			||||||
        STDCONF ("viaproxyname", STR, handle_viaproxyname),
 | 
					        STDCONF (viaproxyname, STR, handle_viaproxyname),
 | 
				
			||||||
        STDCONF ("defaulterrorfile", STR, handle_defaulterrorfile),
 | 
					        STDCONF (defaulterrorfile, STR, handle_defaulterrorfile),
 | 
				
			||||||
        STDCONF ("statfile", STR, handle_statfile),
 | 
					        STDCONF (statfile, STR, handle_statfile),
 | 
				
			||||||
        STDCONF ("stathost", STR, handle_stathost),
 | 
					        STDCONF (stathost, STR, handle_stathost),
 | 
				
			||||||
        STDCONF ("xtinyproxy",  BOOL, handle_xtinyproxy),
 | 
					        STDCONF (xtinyproxy,  BOOL, handle_xtinyproxy),
 | 
				
			||||||
        /* boolean arguments */
 | 
					        /* boolean arguments */
 | 
				
			||||||
        STDCONF ("syslog", BOOL, handle_syslog),
 | 
					        STDCONF (syslog, BOOL, handle_syslog),
 | 
				
			||||||
        STDCONF ("bindsame", BOOL, handle_bindsame),
 | 
					        STDCONF (bindsame, BOOL, handle_bindsame),
 | 
				
			||||||
        STDCONF ("disableviaheader", BOOL, handle_disableviaheader),
 | 
					        STDCONF (disableviaheader, BOOL, handle_disableviaheader),
 | 
				
			||||||
        /* integer arguments */
 | 
					        /* integer arguments */
 | 
				
			||||||
        STDCONF ("port", INT, handle_port),
 | 
					        STDCONF (port, INT, handle_port),
 | 
				
			||||||
        STDCONF ("maxclients", INT, handle_maxclients),
 | 
					        STDCONF (maxclients, INT, handle_maxclients),
 | 
				
			||||||
        STDCONF ("maxspareservers", INT, handle_obsolete),
 | 
					        STDCONF (maxspareservers, INT, handle_obsolete),
 | 
				
			||||||
        STDCONF ("minspareservers", INT, handle_obsolete),
 | 
					        STDCONF (minspareservers, INT, handle_obsolete),
 | 
				
			||||||
        STDCONF ("startservers", INT, handle_obsolete),
 | 
					        STDCONF (startservers, INT, handle_obsolete),
 | 
				
			||||||
        STDCONF ("maxrequestsperchild", INT, handle_obsolete),
 | 
					        STDCONF (maxrequestsperchild, INT, handle_obsolete),
 | 
				
			||||||
        STDCONF ("timeout", INT, handle_timeout),
 | 
					        STDCONF (timeout, INT, handle_timeout),
 | 
				
			||||||
        STDCONF ("connectport", INT, handle_connectport),
 | 
					        STDCONF (connectport, INT, handle_connectport),
 | 
				
			||||||
        /* alphanumeric arguments */
 | 
					        /* alphanumeric arguments */
 | 
				
			||||||
        STDCONF ("user", ALNUM, handle_user),
 | 
					        STDCONF (user, ALNUM, handle_user),
 | 
				
			||||||
        STDCONF ("group", ALNUM, handle_group),
 | 
					        STDCONF (group, ALNUM, handle_group),
 | 
				
			||||||
        /* ip arguments */
 | 
					        /* ip arguments */
 | 
				
			||||||
        STDCONF ("listen", "(" IP "|" IPV6 ")", handle_listen),
 | 
					        STDCONF (listen, "(" IP "|" IPV6 ")", handle_listen),
 | 
				
			||||||
        STDCONF ("allow", "(" "(" IPMASK "|" IPV6MASK ")" "|" ALNUM ")",
 | 
					        STDCONF (allow, "(" "(" IPMASK "|" IPV6MASK ")" "|" ALNUM ")",
 | 
				
			||||||
                 handle_allow),
 | 
					                 handle_allow),
 | 
				
			||||||
        STDCONF ("deny", "(" "(" IPMASK "|" IPV6MASK ")" "|" ALNUM ")",
 | 
					        STDCONF (deny, "(" "(" IPMASK "|" IPV6MASK ")" "|" ALNUM ")",
 | 
				
			||||||
                 handle_deny),
 | 
					                 handle_deny),
 | 
				
			||||||
        STDCONF ("bind", "(" IP "|" IPV6 ")", handle_bind),
 | 
					        STDCONF (bind, "(" IP "|" IPV6 ")", handle_bind),
 | 
				
			||||||
        /* other */
 | 
					        /* other */
 | 
				
			||||||
        STDCONF ("basicauth", ALNUM WS ALNUM, handle_basicauth),
 | 
					        STDCONF (basicauth, ALNUM WS ALNUM, handle_basicauth),
 | 
				
			||||||
        STDCONF ("errorfile", INT WS STR, handle_errorfile),
 | 
					        STDCONF (errorfile, INT WS STR, handle_errorfile),
 | 
				
			||||||
        STDCONF ("addheader",  STR WS STR, handle_addheader),
 | 
					        STDCONF (addheader,  STR WS STR, handle_addheader),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef FILTER_ENABLE
 | 
					#ifdef FILTER_ENABLE
 | 
				
			||||||
        /* filtering */
 | 
					        /* filtering */
 | 
				
			||||||
        STDCONF ("filter", STR, handle_filter),
 | 
					        STDCONF (filter, STR, handle_filter),
 | 
				
			||||||
        STDCONF ("filterurls", BOOL, handle_filterurls),
 | 
					        STDCONF (filterurls, BOOL, handle_filterurls),
 | 
				
			||||||
        STDCONF ("filterextended", BOOL, handle_filterextended),
 | 
					        STDCONF (filterextended, BOOL, handle_filterextended),
 | 
				
			||||||
        STDCONF ("filterdefaultdeny", BOOL, handle_filterdefaultdeny),
 | 
					        STDCONF (filterdefaultdeny, BOOL, handle_filterdefaultdeny),
 | 
				
			||||||
        STDCONF ("filtercasesensitive", BOOL, handle_filtercasesensitive),
 | 
					        STDCONF (filtercasesensitive, BOOL, handle_filtercasesensitive),
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef REVERSE_SUPPORT
 | 
					#ifdef REVERSE_SUPPORT
 | 
				
			||||||
        /* Reverse proxy arguments */
 | 
					        /* Reverse proxy arguments */
 | 
				
			||||||
        STDCONF ("reversebaseurl", STR, handle_reversebaseurl),
 | 
					        STDCONF (reversebaseurl, STR, handle_reversebaseurl),
 | 
				
			||||||
        STDCONF ("reverseonly", BOOL, handle_reverseonly),
 | 
					        STDCONF (reverseonly, BOOL, handle_reverseonly),
 | 
				
			||||||
        STDCONF ("reversemagic", BOOL, handle_reversemagic),
 | 
					        STDCONF (reversemagic, BOOL, handle_reversemagic),
 | 
				
			||||||
        STDCONF ("reversepath", STR "(" WS STR ")?", handle_reversepath),
 | 
					        STDCONF (reversepath, STR "(" WS STR ")?", handle_reversepath),
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef UPSTREAM_SUPPORT
 | 
					#ifdef UPSTREAM_SUPPORT
 | 
				
			||||||
        STDCONF ("upstream",
 | 
					        STDCONF (upstream,
 | 
				
			||||||
                 "(" "(none)" WS STR ")|" \
 | 
					                 "(" "(none)" WS STR ")|" \
 | 
				
			||||||
                 "(" "(http|socks4|socks5)" WS \
 | 
					                 "(" "(http|socks4|socks5)" WS \
 | 
				
			||||||
                     "(" USERNAME /*username*/ ":" PASSWORD /*password*/ "@" ")?"
 | 
					                     "(" USERNAME /*username*/ ":" PASSWORD /*password*/ "@" ")?"
 | 
				
			||||||
@ -259,7 +259,7 @@ struct {
 | 
				
			|||||||
                     ":" INT "(" WS STR ")?" ")", handle_upstream),
 | 
					                     ":" INT "(" WS STR ")?" ")", handle_upstream),
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
        /* loglevel */
 | 
					        /* loglevel */
 | 
				
			||||||
        STDCONF ("loglevel", "(critical|error|warning|notice|connect|info)",
 | 
					        STDCONF (loglevel, "(critical|error|warning|notice|connect|info)",
 | 
				
			||||||
                 handle_loglevel)
 | 
					                 handle_loglevel)
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user