mirror of
https://github.com/Mercantec-GHC/h5-projekt-mst.git
synced 2026-08-27 05:37:39 +02:00
clang-format check
This commit is contained in:
parent
7222da0c74
commit
704f84f430
@ -37,6 +37,9 @@ target=$(build_dir)/backend
|
|||||||
|
|
||||||
all: $(target)
|
all: $(target)
|
||||||
|
|
||||||
|
check:
|
||||||
|
clang-format --dry-run --Werror src/*
|
||||||
|
|
||||||
$(target): $(sources:%.c=$(obj_dir)/%.o)
|
$(target): $(sources:%.c=$(obj_dir)/%.o)
|
||||||
$(LD) -o $@ $(CFLAGS) $(LDFLAGS) $^
|
$(LD) -o $@ $(CFLAGS) $(LDFLAGS) $^
|
||||||
|
|
||||||
|
|||||||
@ -1,63 +1,54 @@
|
|||||||
#include <string.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/select.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
#define PORT 8888
|
#define PORT 8888
|
||||||
|
|
||||||
int print_out_key(
|
int print_out_key(
|
||||||
void *cls,
|
void* cls, enum MHD_ValueKind kind, const char* key, const char* value)
|
||||||
enum MHD_ValueKind kind,
|
|
||||||
const char *key,
|
|
||||||
const char *value)
|
|
||||||
{
|
{
|
||||||
printf ("%s: %s\n", key, value);
|
printf("%s: %s\n", key, value);
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
int answer_to_connection(
|
int answer_to_connection(void* cls,
|
||||||
void *cls,
|
struct MHD_Connection* connection,
|
||||||
struct MHD_Connection *connection,
|
const char* url,
|
||||||
const char *url,
|
const char* method,
|
||||||
const char *method,
|
const char* version,
|
||||||
const char *version,
|
const char* upload_data,
|
||||||
const char *upload_data,
|
size_t* upload_data_size,
|
||||||
size_t *upload_data_size,
|
void** req_cls)
|
||||||
void **req_cls)
|
|
||||||
{
|
{
|
||||||
const char *page = "<html><body>Hello, browser!</body></html>";
|
const char* page = "<html><body>Hello, browser!</body></html>";
|
||||||
struct MHD_Response *response;
|
struct MHD_Response* response;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
MHD_get_connection_values(
|
MHD_get_connection_values(connection,
|
||||||
connection,
|
|
||||||
MHD_HEADER_KIND,
|
MHD_HEADER_KIND,
|
||||||
(MHD_KeyValueIterator)&print_out_key,
|
(MHD_KeyValueIterator)&print_out_key,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
printf ("New %s request for %s using version %s\n", method, url, version);
|
printf("New %s request for %s using version %s\n", method, url, version);
|
||||||
|
|
||||||
response = MHD_create_response_from_buffer(
|
response = MHD_create_response_from_buffer(
|
||||||
strlen(page),
|
strlen(page), (void*)page, MHD_RESPMEM_PERSISTENT);
|
||||||
(void*)page,
|
|
||||||
MHD_RESPMEM_PERSISTENT);
|
|
||||||
|
|
||||||
ret = (int)MHD_queue_response(connection, MHD_HTTP_OK, response);
|
ret = (int)MHD_queue_response(connection, MHD_HTTP_OK, response);
|
||||||
MHD_destroy_response(response);
|
MHD_destroy_response(response);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
printf("hello\n");
|
printf("hello\n");
|
||||||
struct MHD_Daemon *daemon;
|
struct MHD_Daemon* daemon;
|
||||||
|
|
||||||
daemon = MHD_start_daemon(
|
daemon = MHD_start_daemon(MHD_USE_INTERNAL_POLLING_THREAD,
|
||||||
MHD_USE_INTERNAL_POLLING_THREAD,
|
|
||||||
PORT,
|
PORT,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
@ -65,10 +56,10 @@ int main(void)
|
|||||||
NULL,
|
NULL,
|
||||||
MHD_OPTION_END);
|
MHD_OPTION_END);
|
||||||
|
|
||||||
if (NULL == daemon) return 1;
|
if (NULL == daemon)
|
||||||
getchar();
|
return 1;
|
||||||
|
getchar();
|
||||||
|
|
||||||
MHD_stop_daemon(daemon);
|
MHD_stop_daemon(daemon);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user