Mercurial > hg > nginx-quic
diff src/core/ngx_conf_file.c @ 336:ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 18 May 2004 15:29:08 +0000 |
parents | d71c87d11b16 |
children | 4feff829a849 |
line wrap: on
line diff
--- a/src/core/ngx_conf_file.c +++ b/src/core/ngx_conf_file.c @@ -3,7 +3,34 @@ #include <ngx_core.h> -/* Ten fixed arguments */ +static char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); + + +static ngx_command_t ngx_conf_commands[] = { + + { ngx_string("include"), + NGX_ANY_CONF|NGX_CONF_TAKE1, + ngx_conf_include, + 0, + 0, + NULL }, + + ngx_null_command +}; + + +ngx_module_t ngx_conf_module = { + NGX_MODULE, + NULL, /* module context */ + ngx_conf_commands, /* module directives */ + NGX_CONF_MODULE, /* module type */ + NULL, /* init module */ + NULL /* init child */ +}; + + + +/* The ten fixed arguments */ static int argument_number[] = { NGX_CONF_NOARGS, @@ -513,6 +540,27 @@ ngx_log_debug(cf->log, "FOUND %d:'%s'" _ } +static char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_str_t *value, file; + + value = cf->args->elts; + + file.len = cf->cycle->root.len + value[1].len; + if (!(file.data = ngx_palloc(cf->pool, file.len + 1))) { + return NGX_CONF_ERROR; + } + + ngx_cpystrn(ngx_cpymem(file.data, cf->cycle->root.data, + cf->cycle->root.len), + value[1].data, value[1].len + 1); + + ngx_log_error(NGX_LOG_INFO, cf->log, 0, "include %s", file.data); + + return ngx_conf_parse(cf, &file); +} + + ngx_open_file_t *ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name) { ngx_uint_t i;