*/
/*
- * http_config.c: once was auxillary functions for reading httpd's config
+ * http_config.c: once was auxiliary functions for reading httpd's config
* file and converting filenames into a namespace
*
* Rob McCool
*
* Note: 1. We cannot determine if the module was successfully
* removed by ap_remove_module().
- * 2. We have not to complain explicity when the module
+ * 2. We have not to complain explicitly when the module
* is not found because ap_remove_module() did it
* for us already.
*/
if (retval != NULL && strcmp(retval, DECLINE_CMD) != 0) {
/* If the directive in error has already been set, don't
* replace it. Otherwise, an error inside a container
- * will be reported as occuring on the first line of the
+ * will be reported as occurring on the first line of the
* container.
*/
if (!parms->err_directive) {
return strcmp(f1->fname,f2->fname);
}
+/**
+ * Used by -D DUMP_INCLUDES to output the config file "tree".
+ */
+static void dump_config_name(const char *fname, apr_pool_t *p)
+{
+ unsigned i, recursion, line_number;
+ void *data;
+ apr_file_t *out = NULL;
+
+ apr_file_open_stdout(&out, p);
+
+ /* ap_include_sentinel is defined by the core Include directive; use it to
+ * figure out how deep in the stack we are.
+ */
+ apr_pool_userdata_get(&data, "ap_include_sentinel", p);
+
+ if (data) {
+ recursion = *(unsigned *)data;
+ } else {
+ recursion = 0;
+ }
+
+ /* Indent once for each level. */
+ for (i = 0; i < (recursion + 1); ++i) {
+ apr_file_printf(out, " ");
+ }
+
+ /* ap_include_lineno is similarly defined to tell us where in the last
+ * config file we were.
+ */
+ apr_pool_userdata_get(&data, "ap_include_lineno", p);
+
+ if (data) {
+ line_number = *(unsigned *)data;
+ } else {
+ line_number = 0;
+ }
+
+ /* Print the line number and the name of the parsed file. */
+ if (line_number > 0) {
+ apr_file_printf(out, "(%u)", line_number);
+ } else {
+ apr_file_printf(out, "(*)");
+ }
+
+ apr_file_printf(out, " %s\n", fname);
+}
+
AP_DECLARE(const char *) ap_process_resource_config(server_rec *s,
const char *fname,
ap_directive_t **conftree,
fname, &rv);
}
+ if (ap_exists_config_define("DUMP_INCLUDES")) {
+ dump_config_name(fname, p);
+ }
+
parms.config_file = cfp;
error = ap_build_config(&parms, p, ptemp, conftree);
ap_cfg_closefile(cfp);
init_config_globals(p);
+ if (ap_exists_config_define("DUMP_INCLUDES")) {
+ apr_file_t *out = NULL;
+ apr_file_open_stdout(&out, p);
+
+ /* Included files will be dumped as the config is walked; print a
+ * header.
+ */
+ apr_file_printf(out, "Included configuration files:\n");
+ }
+
/* All server-wide config files now have the SAME syntax... */
error = process_command_config(s, ap_server_pre_read_config, conftree,
p, ptemp);