void filelist() {
struct databuffer thisdb;
struct databuffer thisdb2;
thisdb = auto_db("\n"
"
\n"
" Index of: ");
db_append(&outfile, &thisdb);
db_append(&outfile, &url);
thisdb = auto_db("\n"
" \n"
" \n"
" ");
db_append(&outfile, &thisdb);
db_append(&outfile, &url);
thisdb = auto_db("
\n"
" Directory list:
\n"
" ..
\n");
db_append(&outfile, &thisdb);
struct databuffer filelist = file_listdir(db_raw(&file));
const char *filenameptr = filelist.data;
bool lastwasbegin = false;
for (; filenameptr != filelist.data + filelist.len; filenameptr++) {
if (*filenameptr != 0 && !lastwasbegin) {
if (filenameptr[0] != '.') {
thisdb2 = auto_db(filenameptr);
thisdb = auto_db(" ");
db_append(&outfile, &thisdb);
db_append(&outfile, &thisdb2);
thisdb = auto_db("
\n");
db_append(&outfile, &thisdb);
}
lastwasbegin = true;
} else if (*filenameptr == 0) {
lastwasbegin = false;
}
}
thisdb = auto_db(" \n"
"\n");
db_append(&outfile, &thisdb);
}