aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_files.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2006-10-02 08:46:45 +0000
committerIgor Sysoev <igor@sysoev.ru>2006-10-02 08:46:45 +0000
commit97c2f469c342566121bb792c45e8333ad941fb14 (patch)
treebcfa00dd6d977982facbd891857dd9d7e15df686 /src/os/unix/ngx_files.c
parent97c7e1a98621857a5eb2d44c477f7f6384417b52 (diff)
downloadnginx-97c2f469c342566121bb792c45e8333ad941fb14.tar.gz
nginx-97c2f469c342566121bb792c45e8333ad941fb14.zip
glob support in include
Diffstat (limited to 'src/os/unix/ngx_files.c')
-rw-r--r--src/os/unix/ngx_files.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c
index 1801045ab..12e595ee8 100644
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -253,6 +253,40 @@ ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir)
}
+ngx_int_t
+ngx_open_glob(ngx_glob_t *gl)
+{
+ if (glob((char *) gl->pattern, 0, NULL, &gl->pglob) == 0) {
+ return NGX_OK;
+ }
+
+ return NGX_ERROR;
+}
+
+
+ngx_int_t
+ngx_read_glob(ngx_glob_t *gl, ngx_str_t *name)
+{
+ if (gl->n < gl->pglob.gl_pathc) {
+
+ name->len = (size_t) ngx_strlen(gl->pglob.gl_pathv[gl->n]);
+ name->data = (u_char *) gl->pglob.gl_pathv[gl->n];
+ gl->n++;
+
+ return NGX_OK;
+ }
+
+ return NGX_DONE;
+}
+
+
+void
+ngx_close_glob(ngx_glob_t *gl)
+{
+ globfree(&gl->pglob);
+}
+
+
ngx_err_t
ngx_trylock_fd(ngx_fd_t fd)
{