/* See LICENSE file for copyright and license details. */ #ifndef DIRL_H #define DIRL_H #include #include #include #include "http.h" #define DIRL_HEADER ".header.tpl" #define DIRL_ENTRY ".entry.tpl" #define DIRL_FOOTER ".footer.tpl" #define DIRL_STYLE "style.css" #define FAVICON "favicon.ico" /* Default template definitions * * Used if no template files can be found */ #define DIRL_HEADER_DEFAULT \ "\n" \ "\n" \ " \n" \ " \n" \ " Index of {uri}\n" \ " \n" \ " \n" \ "

Index of {uri}

\n" \ "

↵ Parent Directory

\n" \ "
\n" \ " \n" \ " " #define DIRL_ENTRY_DEFAULT \ " \n" \ " \n" \ " \n" \ " \n" #define DIRL_FOOTER_DEFAULT \ "
NameModifiedSize
{entry}{suffix}\n" \ " {modified}{size}
\n" \ "
\n" \ "

Served by dirl" \ "

\n" \ "\n" \ "" struct dirl_templ { char* header; char* entry; char* footer; }; struct dirl_templ dirl_read_templ(const char* path); /* Determine if an dirlist entry should be skipped * * Skips: * - hidden files and directories * - special directory entries (., ..) * - header template: DIRL_HEADER * - entry template: DIRL_ENTRY * - footer template: DIRL_FOOTER * - dirlist style: DRIL_STYLE */ int dirl_skip(const char*); /* Print header into the response */ enum status dirl_header(int, const struct response*, const struct dirl_templ*); /* Print entry into the response */ enum status dirl_entry(int, const struct dirent*, const struct response*, const struct dirl_templ*); /* Print footer into the response */ enum status dirl_footer(int, const struct dirl_templ*); #endif /* DIRL_H */