View | Details | Raw Unified | Return to bug 59376
Collapse All | Expand All

(-)a/server/config.c (+62 lines)
Lines 1782-1787 static int fname_alphasort(const void *fn1, const void *fn2) Link Here
1782
    return strcmp(f1->fname,f2->fname);
1782
    return strcmp(f1->fname,f2->fname);
1783
}
1783
}
1784
1784
1785
/**
1786
 * Used by -D DUMP_INCLUDES to output the config file "tree".
1787
 */
1788
static void dump_config_name(const char *fname, apr_pool_t *p)
1789
{
1790
    unsigned i, recursion, line_number;
1791
    void *data;
1792
    apr_file_t *out = NULL;
1793
1794
    apr_file_open_stdout(&out, p);
1795
1796
    /* ap_include_sentinel is defined by the core Include directive; use it to
1797
     * figure out how deep in the stack we are.
1798
     */
1799
    apr_pool_userdata_get(&data, "ap_include_sentinel", p);
1800
1801
    if (data) {
1802
        recursion = *(unsigned *)data;
1803
    } else {
1804
        recursion = 0;
1805
    }
1806
1807
    /* Indent once for each level. */
1808
    for (i = 0; i < (recursion + 1); ++i) {
1809
        apr_file_printf(out, "  ");
1810
    }
1811
1812
    /* ap_include_lineno is similarly defined to tell us where in the last
1813
     * config file we were.
1814
     */
1815
    apr_pool_userdata_get(&data, "ap_include_lineno", p);
1816
1817
    if (data) {
1818
        line_number = *(unsigned *)data;
1819
    } else {
1820
        line_number = 0;
1821
    }
1822
1823
    /* Print the line number and the name of the parsed file. */
1824
    if (line_number > 0) {
1825
        apr_file_printf(out, "(%u)", line_number);
1826
    } else {
1827
        apr_file_printf(out, "(*)");
1828
    }
1829
1830
    apr_file_printf(out, " %s\n", fname);
1831
}
1832
1785
AP_DECLARE(const char *) ap_process_resource_config(server_rec *s,
1833
AP_DECLARE(const char *) ap_process_resource_config(server_rec *s,
1786
                                                    const char *fname,
1834
                                                    const char *fname,
1787
                                                    ap_directive_t **conftree,
1835
                                                    ap_directive_t **conftree,
Lines 1806-1811 AP_DECLARE(const char *) ap_process_resource_config(server_rec *s, Link Here
1806
                            fname, &rv);
1854
                            fname, &rv);
1807
    }
1855
    }
1808
1856
1857
    if (ap_exists_config_define("DUMP_INCLUDES")) {
1858
        dump_config_name(fname, p);
1859
    }
1860
1809
    parms.config_file = cfp;
1861
    parms.config_file = cfp;
1810
    error = ap_build_config(&parms, p, ptemp, conftree);
1862
    error = ap_build_config(&parms, p, ptemp, conftree);
1811
    ap_cfg_closefile(cfp);
1863
    ap_cfg_closefile(cfp);
Lines 2402-2407 AP_DECLARE(server_rec*) ap_read_config(process_rec *process, apr_pool_t *ptemp, Link Here
2402
2454
2403
    init_config_globals(p);
2455
    init_config_globals(p);
2404
2456
2457
    if (ap_exists_config_define("DUMP_INCLUDES")) {
2458
        apr_file_t *out = NULL;
2459
        apr_file_open_stdout(&out, p);
2460
2461
        /* Included files will be dumped as the config is walked; print a
2462
         * header.
2463
         */
2464
        apr_file_printf(out, "Included configuration files:\n");
2465
    }
2466
2405
    /* All server-wide config files now have the SAME syntax... */
2467
    /* All server-wide config files now have the SAME syntax... */
2406
    error = process_command_config(s, ap_server_pre_read_config, conftree,
2468
    error = process_command_config(s, ap_server_pre_read_config, conftree,
2407
                                   p, ptemp);
2469
                                   p, ptemp);
(-)a/server/core.c (+22 lines)
Lines 3247-3252 static const char *include_config (cmd_parms *cmd, void *dummy, Link Here
3247
    int optional = cmd->cmd->cmd_data ? 1 : 0;
3247
    int optional = cmd->cmd->cmd_data ? 1 : 0;
3248
    void *data;
3248
    void *data;
3249
3249
3250
    /* NOTE: ap_include_sentinel is also used by ap_process_resource_config()
3251
     * during DUMP_INCLUDES; don't change its type or remove it without updating
3252
     * the other.
3253
     */
3250
    apr_pool_userdata_get(&data, "ap_include_sentinel", cmd->pool);
3254
    apr_pool_userdata_get(&data, "ap_include_sentinel", cmd->pool);
3251
    if (data) {
3255
    if (data) {
3252
        recursion = data;
3256
        recursion = data;
Lines 3271-3276 static const char *include_config (cmd_parms *cmd, void *dummy, Link Here
3271
                           name, NULL);
3275
                           name, NULL);
3272
    }
3276
    }
3273
3277
3278
    if (ap_exists_config_define("DUMP_INCLUDES")) {
3279
        unsigned *line_number;
3280
3281
        /* NOTE: ap_include_lineno is used by ap_process_resource_config()
3282
         * during DUMP_INCLUDES; don't change its type or remove it without
3283
         * updating the other.
3284
         */
3285
        apr_pool_userdata_get(&data, "ap_include_lineno", cmd->pool);
3286
        if (data) {
3287
            line_number = data;
3288
        } else {
3289
            data = line_number = apr_palloc(cmd->pool, sizeof(*line_number));
3290
            apr_pool_userdata_setn(data, "ap_include_lineno", NULL, cmd->pool);
3291
        }
3292
3293
        *line_number = cmd->config_file->line_number;
3294
    }
3295
3274
    error = ap_process_fnmatch_configs(cmd->server, conffile, &conftree,
3296
    error = ap_process_fnmatch_configs(cmd->server, conffile, &conftree,
3275
                                       cmd->pool, cmd->temp_pool,
3297
                                       cmd->pool, cmd->temp_pool,
3276
                                       optional);
3298
                                       optional);
(-)a/server/main.c (-1 / +5 lines)
Lines 448-453 static void usage(process_rec *process) Link Here
448
    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
448
    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
449
                 "  -M                 : a synonym for -t -D DUMP_MODULES");
449
                 "  -M                 : a synonym for -t -D DUMP_MODULES");
450
    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
450
    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
451
                 "  -t -D DUMP_INCLUDES: show all included configuration files");
452
    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
451
                 "  -t                 : run syntax check for config files");
453
                 "  -t                 : run syntax check for config files");
452
    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
454
    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
453
                 "  -T                 : start without DocumentRoot(s) check");
455
                 "  -T                 : start without DocumentRoot(s) check");
Lines 546-551 int main(int argc, const char * const argv[]) Link Here
546
            /* Setting -D DUMP_MODULES is equivalent to setting -M */
548
            /* Setting -D DUMP_MODULES is equivalent to setting -M */
547
            else if (strcmp(opt_arg, "DUMP_MODULES") == 0)
549
            else if (strcmp(opt_arg, "DUMP_MODULES") == 0)
548
                ap_run_mode = AP_SQ_RM_CONFIG_DUMP;
550
                ap_run_mode = AP_SQ_RM_CONFIG_DUMP;
551
            /* Setting -D DUMP_INCLUDES is a type of configuration dump */
552
            else if (strcmp(opt_arg, "DUMP_INCLUDES") == 0)
553
                ap_run_mode = AP_SQ_RM_CONFIG_DUMP;
549
            break;
554
            break;
550
555
551
        case 'e':
556
        case 'e':
552
- 

Return to bug 59376