]> prime8.dev >> repos - ttyd.git/commitdiff
Reformat C source files
authorShuanglei Tao <tsl0922@gmail.com>
Wed, 21 Dec 2016 14:50:23 +0000 (22:50 +0800)
committerShuanglei Tao <tsl0922@gmail.com>
Wed, 21 Dec 2016 15:10:18 +0000 (23:10 +0800)
src/http.c
src/protocol.c
src/server.c

index 25026514d35957197f46a367b7d6f71d0b9019ba..4b92bb875e6421f641fdb6f7088ce31a843eb689 100644 (file)
@@ -82,7 +82,7 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user, voi
             p = buffer + LWS_PRE;
             end = p + sizeof(buffer) - LWS_PRE;
 
-            if (!strncmp((const char *)in, "/auth_token.js", 14)) {
+            if (!strncmp((const char *) in, "/auth_token.js", 14)) {
                 size_t n = server->credential != NULL ? sprintf(buf, "var tty_auth_token = '%s';", server->credential) : 0;
 
                 if (lws_add_http_header_status(wsi, HTTP_STATUS_OK, &p, end))
@@ -128,10 +128,10 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user, voi
                 return 1;
             goto try_to_reuse;
         case LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION:
-            if (!len || (SSL_get_verify_result((SSL*)in) != X509_V_OK)) {
-                int err = X509_STORE_CTX_get_error((X509_STORE_CTX*)user);
-                int depth = X509_STORE_CTX_get_error_depth((X509_STORE_CTX*)user);
-                const charmsg = X509_verify_cert_error_string(err);
+            if (!len || (SSL_get_verify_result((SSL *) in) != X509_V_OK)) {
+                int err = X509_STORE_CTX_get_error((X509_STORE_CTX *) user);
+                int depth = X509_STORE_CTX_get_error_depth((X509_STORE_CTX *) user);
+                const char *msg = X509_verify_cert_error_string(err);
                 lwsl_err("client certificate verification error: %s (%d), depth: %d\n", msg, err, depth);
                 return 1;
             }
index d3ef9254709685ad7e128cecc326ff00d8fefb9f..e8e1637c0451db1f6e1d0740bd14a511ef27cd7b 100644 (file)
@@ -255,7 +255,7 @@ callback_tty(struct lws *wsi, enum lws_callback_reasons reason,
                 t_free(frame->data);
                 t_free(frame);
 
-                if(lws_partial_buffered(wsi)){
+                if (lws_partial_buffered(wsi)) {
                     lws_callback_on_writable(wsi);
                     break;
                 }
index dd974559e014f63b0032380eb471a711b7108747..8c215cba1e9bc748c7dd48fd94abc080c02cc87e 100644 (file)
@@ -22,24 +22,24 @@ static const struct lws_extension extensions[] = {
 
 // command line options
 static const struct option options[] = {
-        {"port", required_argument, NULL, 'p'},
-        {"interface", required_argument, NULL, 'i'},
-        {"credential", required_argument, NULL, 'c'},
-        {"uid", required_argument, NULL, 'u'},
-        {"gid", required_argument, NULL, 'g'},
-        {"signal", required_argument, NULL, 's'},
-        {"reconnect", required_argument, NULL, 'r'},
-        {"ssl", no_argument, NULL, 'S'},
-        {"ssl-cert", required_argument, NULL, 'C'},
-        {"ssl-key", required_argument, NULL, 'K'},
-        {"ssl-ca", required_argument, NULL, 'A'},
-        {"readonly", no_argument, NULL, 'R'},
-        {"check-origin", no_argument, NULL, 'O'},
-        {"once", no_argument, NULL, 'o'},
-        {"debug", required_argument, NULL, 'd'},
-        {"version", no_argument, NULL, 'v'},
-        {"help", no_argument, NULL, 'h'},
-        {NULL, 0, 0, 0}
+        {"port",         required_argument, NULL, 'p'},
+        {"interface",    required_argument, NULL, 'i'},
+        {"credential",   required_argument, NULL, 'c'},
+        {"uid",          required_argument, NULL, 'u'},
+        {"gid",          required_argument, NULL, 'g'},
+        {"signal",       required_argument, NULL, 's'},
+        {"reconnect",    required_argument, NULL, 'r'},
+        {"ssl",          no_argument,       NULL, 'S'},
+        {"ssl-cert",     required_argument, NULL, 'C'},
+        {"ssl-key",      required_argument, NULL, 'K'},
+        {"ssl-ca",       required_argument, NULL, 'A'},
+        {"readonly",     no_argument,       NULL, 'R'},
+        {"check-origin", no_argument,       NULL, 'O'},
+        {"once",         no_argument,       NULL, 'o'},
+        {"debug",        required_argument, NULL, 'd'},
+        {"version",      no_argument,       NULL, 'v'},
+        {"help",         no_argument,       NULL, 'h'},
+        {NULL, 0, 0,                              0}
 };
 static const char *opt_string = "p:i:c:u:g:s:r:aSC:K:A:Rt:Ood:vh";
 
@@ -279,8 +279,8 @@ main(int argc, char **argv) {
                 break;
             case 't':
                 optind--;
-                for(;optind < start && *argv[optind] != '-'; optind++){
-                    char *option =strdup(optarg);
+                for (; optind < start && *argv[optind] != '-'; optind++) {
+                    char *option = strdup(optarg);
                     char *key = strsep(&option, "=");
                     if (key == NULL) {
                         fprintf(stderr, "ttyd: invalid client option: %s, format: key=value\n", optarg);