1
0
Fork 0
mirror of https://gitlab.com/niansa/simpsh-httpd.git synced 2025-03-06 20:53:36 +01:00
simpsh-httpd/cport/main.c
2020-09-12 21:02:44 +00:00

52 lines
851 B
C
Executable file

//usr/bin/tcc -run
#include "definitions.h"
struct databuffer outfile;
static bool done = false;
struct databuffer url;
struct databuffer file;
struct databuffer contenttype;
#include "init.c"
#include "config.c"
#include "readrequest.c"
#include "httpheaders.c"
#include "urlcheck.c"
#include "filelist.c"
#include "sendfile.c"
int main() {
db_init(&outfile);
db_init(&url);
db_init(&file);
db_init(&contenttype);
// Variable intialisation
init();
// Read the config file
config();
// Read the HTTP-request
readrequest();
// Some URL checks and modifications
urlcheck();
// Skip following step, if the document was already created successfully
if (!done) {
// Write finished file
sendfile();
}
// Print finished document
db_fwrite(&outfile, stdout);
// Remove the temporary file
db_deinit(&outfile);
return 0;
}