project(ttyd)
-set(SOURCE_FILES server.c http.c protocol.c utils.c)
+set(SOURCE_FILES src/server.c src/http.c src/protocol.c src/utils.c)
find_package(OpenSSL REQUIRED)
find_package(Libwebsockets QUIET)
find_program(CMAKE_XXD NAMES xxd)
add_custom_command(OUTPUT html.h
COMMAND ${CMAKE_XXD} -i index.html html.h
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src
COMMENT "Generating html.h from index.html")
list(APPEND SOURCE_FILES html.h)
// TODO: this doesn't work for websocket
switch (check_auth(wsi)) {
- case 1:
- return 1;
+ case 0:
+ break;
case -1:
goto try_to_reuse;
- case 0:
+ case 1:
default:
- break;
+ return 1;
}
// if a legal POST URL, let it continue and accept data
// do not print error message for invalid option
opterr = 0;
- while (getopt_long(argc_copy, argv_copy, opt_string, options, NULL) != -1);
+ while (getopt_long(argc_copy, argv_copy, opt_string, options, NULL) != -1)
+ ;
int start = -1;
if (optind < argc) {