aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_conf_file.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-05-18 15:29:08 +0000
committerIgor Sysoev <igor@sysoev.ru>2004-05-18 15:29:08 +0000
commitab517d58277429bba16d0641e00aebea061db1ce (patch)
treefca49eca624c51e0ae7c829f0ce64233496c610e /src/core/ngx_conf_file.c
parent3043bfcf105e47969720d5bce8c3a89afe8e666d (diff)
downloadnginx-ab517d58277429bba16d0641e00aebea061db1ce.tar.gz
nginx-ab517d58277429bba16d0641e00aebea061db1ce.zip
nginx-0.0.3-2004-05-18-19:29:08 import
Diffstat (limited to 'src/core/ngx_conf_file.c')
-rw-r--r--src/core/ngx_conf_file.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index fc4c95079..bb05b72db 100644
--- 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'" _ word->len _ word->data);
}
+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;