]> prime8.dev >> repos - ttyd.git/commitdiff
Move source files to src
authorShuanglei Tao <tsl0922@gmail.com>
Mon, 19 Sep 2016 14:20:40 +0000 (22:20 +0800)
committerShuanglei Tao <tsl0922@gmail.com>
Mon, 19 Sep 2016 14:20:40 +0000 (22:20 +0800)
CMakeLists.txt
src/http.c [moved from http.c with 100% similarity]
src/index.html [moved from index.html with 100% similarity]
src/protocol.c [moved from protocol.c with 100% similarity]
src/server.c [moved from server.c with 99% similarity]
src/server.h [moved from server.h with 100% similarity]
src/utils.c [moved from utils.c with 100% similarity]
src/utils.h [moved from utils.h with 100% similarity]

index 0499f95dbd699c697c741acf5543e7348858d234..5fc296f085501801860123a00050e70b436e6758 100644 (file)
@@ -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)
 
similarity index 100%
rename from http.c
rename to src/http.c
index c7d1681e5b50ef14274222e392446e39efd14e32..7147ec5bc380ab66ba443d8d4d041813fdf7fa97 100644 (file)
--- a/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
similarity index 100%
rename from index.html
rename to src/index.html
similarity index 100%
rename from protocol.c
rename to src/protocol.c
similarity index 99%
rename from server.c
rename to src/server.c
index aba04060554cf6d304a5ad4763d5d94481c5432d..d1d0b35ef0f20be3f1ffda8895466ac292a36809 100644 (file)
--- a/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) {
similarity index 100%
rename from server.h
rename to src/server.h
similarity index 100%
rename from utils.c
rename to src/utils.c
similarity index 100%
rename from utils.h
rename to src/utils.h