# HG changeset patch # User John Tsiombikas # Date 1429579982 -10800 # Node ID 2874f61a43b11399270a962f70b526024548ac69 # Parent 2873d3ec8c78397066588dc93c907509ecf56a30 implementing the directory index generation diff -r 2873d3ec8c78 -r 2874f61a43b1 libtinyweb/src/genpage.c --- a/libtinyweb/src/genpage.c Mon Apr 20 10:17:22 2015 +0300 +++ b/libtinyweb/src/genpage.c Tue Apr 21 04:33:02 2015 +0300 @@ -34,10 +34,25 @@ int gen_index(struct page *pg, const char *path) { + DIR *dir; + struct dirent *dent; + static char pathbuf[256]; + + if(!(dir = opendir(path))) { + logmsg("failed to generate index page for %s, opendir failed: %s\n", path, strerror(errno)); + return -1; + } + + while((dent = readdir(dir))) { + } + + closedir(dir); + return 0; } int gen_error(struct page *pg, int errcode, const char *uri) { + return 0; /* TODO */ } void destroy_page(struct page *pg)