2022-11-19 11:42:19 +01:00
|
|
|
#include <microhttpd.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdio.h>
|
2022-11-19 23:18:44 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include "handlers.h"
|
2022-11-19 11:42:19 +01:00
|
|
|
|
|
|
|
|
int main(int argc,
|
|
|
|
|
char ** argv) {
|
|
|
|
|
struct MHD_Daemon * d;
|
|
|
|
|
if (argc != 2) {
|
|
|
|
|
printf("%s PORT\n",
|
|
|
|
|
argv[0]);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
d = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION,
|
|
|
|
|
atoi(argv[1]),
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
2022-11-19 23:18:44 +01:00
|
|
|
&handle_all,
|
2022-11-20 07:47:52 +01:00
|
|
|
NULL,
|
2022-11-19 11:42:19 +01:00
|
|
|
MHD_OPTION_END);
|
|
|
|
|
if (d == NULL)
|
|
|
|
|
return 1;
|
|
|
|
|
(void) getc (stdin);
|
|
|
|
|
MHD_stop_daemon(d);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|