summaryrefslogtreecommitdiff
path: root/src/mod_dirlisting.c
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2017-10-22 21:07:16 +0200
committerStefan Bühler <stbuehler@web.de>2017-11-07 10:30:51 +0100
commitebf8b11abb4a219ffc4ab93599e99fefa46d9539 (patch)
tree4c3b119cb271a12018e3a5ff8bfe0b23602dae07 /src/mod_dirlisting.c
parentc383ff562ce53ed86ba6c0d6bb3d5a1bbfef2dba (diff)
downloadlighttpd-git-ebf8b11abb4a219ffc4ab93599e99fefa46d9539.tar.gz
[WIP] build systems cleanuppersonal/stbuehler/cleanup-build
Diffstat (limited to 'src/mod_dirlisting.c')
-rw-r--r--src/mod_dirlisting.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/mod_dirlisting.c b/src/mod_dirlisting.c
index 597ec3b7..032e0443 100644
--- a/src/mod_dirlisting.c
+++ b/src/mod_dirlisting.c
@@ -21,18 +21,22 @@
* this is a dirlisting for a lighttpd plugin
*/
-#ifdef HAVE_ATTR_ATTRIBUTES_H
-#include <attr/attributes.h>
-#endif
-
-#ifdef HAVE_SYS_EXTATTR_H
-#include <sys/extattr.h>
+#if defined(WITH_XATTR)
+# if defined(HAVE_LIBATTR)
+/* linux */
+# include <attr/attributes.h>
+# elif defined(HAVE_EXTATTR)
+/* BSD */
+# include <sys/extattr.h>
+# else
+# error Unknown extended attribute support
+# endif
#endif
/* plugin config for all request/connections */
typedef struct {
-#ifdef HAVE_PCRE_H
+#if defined(WITH_PCRE)
pcre *regex;
#endif
buffer *string;
@@ -84,7 +88,7 @@ static excludes_buffer *excludes_buffer_init(void) {
}
static int excludes_buffer_append(excludes_buffer *exb, buffer *string) {
-#ifdef HAVE_PCRE_H
+#if defined(WITH_PCRE)
size_t i;
const char *errptr;
int erroff;
@@ -131,7 +135,7 @@ static int excludes_buffer_append(excludes_buffer *exb, buffer *string) {
}
static void excludes_buffer_free(excludes_buffer *exb) {
-#ifdef HAVE_PCRE_H
+#if defined(WITH_PCRE)
size_t i;
for (i = 0; i < exb->size; i++) {
@@ -297,7 +301,7 @@ SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) {
return HANDLER_ERROR;
}
-#ifndef HAVE_PCRE_H
+#if !defined(WITH_PCRE)
if (excludes_list->used > 0) {
log_error_write(srv, __FILE__, __LINE__, "sss",
"pcre support is missing for: ", CONFIG_EXCLUDE, ", please install libpcre and the headers");
@@ -913,7 +917,7 @@ static int http_list_directory(server *srv, connection *con, plugin_data *p, buf
char datebuf[sizeof("2005-Jan-01 22:23:24")];
const char *content_type;
long name_max;
-#if defined(HAVE_XATTR) || defined(HAVE_EXTATTR)
+#if defined(WITH_XATTR)
char attrval[128];
int attrlen;
#endif
@@ -986,7 +990,7 @@ static int http_list_directory(server *srv, connection *con, plugin_data *p, buf
/* compare d_name against excludes array
* elements, skipping any that match.
*/
-#ifdef HAVE_PCRE_H
+#if defined(WITH_PCRE)
for(i = 0; i < p->conf.excludes->used; i++) {
int n;
#define N 10
@@ -1082,7 +1086,8 @@ static int http_list_directory(server *srv, connection *con, plugin_data *p, buf
tmp = files.ent[i];
content_type = NULL;
-#if defined(HAVE_XATTR)
+#if defined(WITH_XATTR)
+#if defined(HAVE_LIBATTR)
if (con->conf.use_xattr) {
memcpy(path_file, DIRLIST_ENT_NAME(tmp), tmp->namelen + 1);
attrlen = sizeof(attrval) - 1;
@@ -1100,6 +1105,7 @@ static int http_list_directory(server *srv, connection *con, plugin_data *p, buf
}
}
#endif
+#endif
if (content_type == NULL) {
const buffer *type = stat_cache_mimetype_by_ext(con, DIRLIST_ENT_NAME(tmp), tmp->namelen);