From: Amos Jeffries Date: Thu, 30 Sep 2010 01:12:15 +0000 (-0600) Subject: Documentation: display default-if-none instead of 'none' defaults. X-Git-Tag: take1~220 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c58a4b535be1d6a8d7585c51b19261b49bd31eea;p=thirdparty%2Fsquid.git Documentation: display default-if-none instead of 'none' defaults. Updates the parser to accept DEFAULT_IF_NONE: as a valid default value instead of requiring "DEFAULT: none" to be explicitly configured. This removes several cases from the docs where 'none' is displayed but means 'no default' rather than the text value of "none" being possible. --- diff --git a/scripts/www/build-cfg-help.pl b/scripts/www/build-cfg-help.pl index 06c53a65c8..caefc1a224 100755 --- a/scripts/www/build-cfg-help.pl +++ b/scripts/www/build-cfg-help.pl @@ -20,6 +20,7 @@ use File::Basename; # IFDEF: # TYPE: # DEFAULT: +# DEFAULT_IF_NONE: # LOC: # DOC_START # documentation goes here @@ -252,6 +253,8 @@ while (<>) { } else { $data->{"default"} = "$name $1"; } + } elsif ($_ =~ /^DEFAULT_IF_NONE: (.*)$/) { + $data->{"default"} = "$name $1"; } elsif ($_ =~ /^LOC:(.*)$/) { $data->{"loc"} = $1; $data->{"loc"} =~ s/^[\s\t]*//; diff --git a/src/cf.data.pre b/src/cf.data.pre index a0ac4c2042..723b9d79dd 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -817,7 +817,6 @@ NAME: follow_x_forwarded_for TYPE: acl_access IFDEF: FOLLOW_X_FORWARDED_FOR LOC: Config.accessList.followXFF -DEFAULT: none DEFAULT_IF_NONE: deny all DOC_START Allowing or Denying the X-Forwarded-For header to be followed to @@ -924,7 +923,6 @@ DOC_END NAME: http_access TYPE: acl_access LOC: Config.accessList.http -DEFAULT: none DEFAULT_IF_NONE: deny all DOC_START Allowing or Denying access based on defined access lists @@ -1019,7 +1017,6 @@ DOC_END NAME: icp_access TYPE: acl_access LOC: Config.accessList.icp -DEFAULT: none DEFAULT_IF_NONE: deny all DOC_START Allowing or Denying access to the ICP port based on defined @@ -1041,7 +1038,6 @@ NAME: htcp_access IFDEF: USE_HTCP TYPE: acl_access LOC: Config.accessList.htcp -DEFAULT: none DEFAULT_IF_NONE: deny all DOC_START Allowing or Denying access to the HTCP port based on defined @@ -1067,7 +1063,6 @@ NAME: htcp_clr_access IFDEF: USE_HTCP TYPE: acl_access LOC: Config.accessList.htcp_clr -DEFAULT: none DEFAULT_IF_NONE: deny all DOC_START Allowing or Denying access to purge content using HTCP based @@ -1110,7 +1105,6 @@ DOC_END NAME: ident_lookup_access TYPE: acl_access IFDEF: USE_IDENT -DEFAULT: none DEFAULT_IF_NONE: deny all LOC: Ident::TheConfig.identLookup DOC_START @@ -2758,7 +2752,6 @@ DOC_END NAME: access_log cache_access_log TYPE: access_log LOC: Config.Log.accesslogs -DEFAULT: none DEFAULT_IF_NONE: daemon:@DEFAULT_ACCESS_LOG@ squid DOC_START These files log client request activities. Has a line every HTTP or @@ -3166,7 +3159,6 @@ COMMENT_END NAME: cache_log TYPE: string -DEFAULT: none DEFAULT_IF_NONE: @DEFAULT_CACHE_LOG@ LOC: Debug::cache_log DOC_START @@ -3197,7 +3189,6 @@ DOC_END NAME: coredump_dir TYPE: string LOC: Config.coredump_dir -DEFAULT: none DEFAULT_IF_NONE: none DOC_START By default Squid leaves core files in the directory from where @@ -4861,7 +4852,6 @@ DOC_END NAME: wccp2_service TYPE: wccp2_service LOC: Config.Wccp2.info -DEFAULT: none DEFAULT_IF_NONE: standard 0 IFDEF: USE_WCCPv2 DOC_START @@ -5090,7 +5080,6 @@ DOC_END NAME: snmp_access TYPE: acl_access LOC: Config.accessList.snmp -DEFAULT: none DEFAULT_IF_NONE: deny all IFDEF: SQUID_SNMP DOC_START @@ -6423,7 +6412,6 @@ NAME: icap_retry TYPE: acl_access IFDEF: ICAP_CLIENT LOC: Adaptation::Icap::TheConfig.repeat -DEFAULT: none DEFAULT_IF_NONE: deny all DOC_START This ACL determines which retriable ICAP transactions are @@ -6890,7 +6878,6 @@ NAME: as_whois_server TYPE: string LOC: Config.as_whois_server DEFAULT: whois.ra.net -DEFAULT_IF_NONE: whois.ra.net DOC_START WHOIS server to query for AS numbers. NOTE: AS numbers are queried only when Squid starts up, not for every request. diff --git a/src/cf_gen.cc b/src/cf_gen.cc index c3b19b761f..e64e267a6a 100644 --- a/src/cf_gen.cc +++ b/src/cf_gen.cc @@ -562,27 +562,25 @@ gen_default(Entry * head, FILE * fp) continue; } - if (entry->default_value == NULL) { + if (entry->default_value == NULL && entry->default_if_none == NULL) { fprintf(stderr, "NO DEFAULT FOR %s\n", entry->name); rc |= 1; continue; } - assert(entry->default_value); - - if (entry->ifdef) - fprintf(fp, "#if %s\n", entry->ifdef); - - if (strcmp(entry->default_value, "none") == 0) { + if (entry->default_value == NULL || strcmp(entry->default_value, "none") == 0) { fprintf(fp, "\t/* No default for %s */\n", entry->name); } else { + if (entry->ifdef) + fprintf(fp, "#if %s\n", entry->ifdef); + fprintf(fp, "\tdefault_line(\"%s %s\");\n", entry->name, entry->default_value); - } - if (entry->ifdef) - fprintf(fp, "#endif\n"); + if (entry->ifdef) + fprintf(fp, "#endif\n"); + } } fprintf(fp, "\tcfg_filename = NULL;\n");