import "ecere" static const char * indexNames[] = { "index.html", "index.htm", "home.html", "home.htm", "welcome.html", "welcome.htm", "default.html", "default.htm" }; #define NUM_INDEX (sizeof(indexNames) / sizeof(char *)) static void WriteFileName(File f, const char * fileName) { byte ch; int c; for(c = 0; (ch = fileName[c]); c++) { if(ch <= 32 || ch > 128) { byte nibble; f.Putc('%'); nibble = (ch & 0xF0) >> 4; f.Putc((char)((nibble > 9) ? (nibble - 10 + 'a') : (nibble + '0'))); nibble = ch & 0x0F; f.Putc((char)((nibble > 9) ? (nibble - 10 + 'a') : (nibble + '0'))); } else f.Putc(ch); } } #define CONTENT_PATH "." static void CreateDirectoryListing(File f, char * directory) { FileListing listing { directory }; f.Puts("
\r\n"); if(directory[0] && directory[1] && (directory[1] != ':' || (directory[2] && directory[3]))) f.Puts("../