From: Shuanglei Tao Date: Mon, 19 Sep 2016 14:20:40 +0000 (+0800) Subject: Move source files to src X-Git-Url: http://git.prime8.dev/?a=commitdiff_plain;h=1f579b491adb16504c738fd26c3ddfab07be6cc2;p=ttyd.git Move source files to src --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0499f95..5fc296f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ set(CMAKE_C_STANDARD 99) 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) @@ -33,7 +33,7 @@ mark_as_advanced(JSON-C_INCLUDE_DIR JSON-C_LIBRARY) 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) diff --git a/http.c b/src/http.c similarity index 100% rename from http.c rename to src/http.c index c7d1681..7147ec5 100644 --- a/http.c +++ b/src/http.c @@ -72,13 +72,13 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user, voi // 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 diff --git a/index.html b/src/index.html similarity index 100% rename from index.html rename to src/index.html diff --git a/protocol.c b/src/protocol.c similarity index 100% rename from protocol.c rename to src/protocol.c diff --git a/server.c b/src/server.c similarity index 99% rename from server.c rename to src/server.c index aba0406..d1d0b35 100644 --- a/server.c +++ b/src/server.c @@ -111,7 +111,8 @@ calc_command_start(int argc, char **argv) { // 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) { diff --git a/server.h b/src/server.h similarity index 100% rename from server.h rename to src/server.h diff --git a/utils.c b/src/utils.c similarity index 100% rename from utils.c rename to src/utils.c diff --git a/utils.h b/src/utils.h similarity index 100% rename from utils.h rename to src/utils.h