This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 7395e137e010a890e5485382b376ffa88da235c6 Author: Marco Casaroli <[email protected]> AuthorDate: Mon Nov 2 11:25:04 2026 +0100 apps: Fix the nxstyle errors in the files of the SIGPIPE fixes. The next commits change these files, and the CI check runs nxstyle on each changed file as a whole. These errors are older than the change: the indentation of switch statements and of bare blocks, a missing blank line after declarations, and missing braces after if. In httpd.c, the declaration of v moves from the switch to the start of the loop body, and the re-indented switch needs two wrapped lines. Also fix three spelling errors in two comments of tcp_ipc_server_main.c, two of which codespell reports. No functional change: git diff -w shows only the braces, the moved declaration, the wrapped lines and the spelling. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- examples/netloop/lo_listener.c | 2 +- examples/poll/net_listener.c | 2 +- examples/poll/net_reader.c | 8 +- examples/tcp_ipc_server/tcp_ipc_server_main.c | 6 +- examples/xmlrpc/xmlrpc_main.c | 8 +- netutils/ftpd/ftpd.c | 304 ++++++++++++++------------ netutils/webserver/httpd.c | 212 +++++++++--------- system/telnet/telnet_chatd.c | 64 +++--- 8 files changed, 315 insertions(+), 291 deletions(-) diff --git a/examples/netloop/lo_listener.c b/examples/netloop/lo_listener.c index 57362cec8..a1ad46b05 100644 --- a/examples/netloop/lo_listener.c +++ b/examples/netloop/lo_listener.c @@ -203,7 +203,7 @@ static inline bool net_connection(struct net_listener_s *nls) FD_SET(sd, &nls->master); if (sd > nls->mxsd) { - nls->mxsd = sd; + nls->mxsd = sd; } return true; diff --git a/examples/poll/net_listener.c b/examples/poll/net_listener.c index 3c72e16e3..2e04e3945 100644 --- a/examples/poll/net_listener.c +++ b/examples/poll/net_listener.c @@ -203,7 +203,7 @@ static inline bool net_connection(struct net_listener_s *nls) FD_SET(sd, &nls->master); if (sd > nls->mxsd) { - nls->mxsd = sd; + nls->mxsd = sd; } return true; diff --git a/examples/poll/net_reader.c b/examples/poll/net_reader.c index 191f39875..cd02dabfb 100644 --- a/examples/poll/net_reader.c +++ b/examples/poll/net_reader.c @@ -169,7 +169,7 @@ static void net_receive(int sd) printf("net_reader: recv failed sd=%d: %d\n", sd, errno); if (errno != EAGAIN) { - return; + return; } } } @@ -192,9 +192,9 @@ static void net_receive(int sd) { if (errno != EINTR) { - printf("net_reader: Send failed sd=%d: %d\n", - sd, errno); - return; + printf("net_reader: Send failed sd=%d: %d\n", + sd, errno); + return; } } else diff --git a/examples/tcp_ipc_server/tcp_ipc_server_main.c b/examples/tcp_ipc_server/tcp_ipc_server_main.c index af9aff823..5953f9b48 100644 --- a/examples/tcp_ipc_server/tcp_ipc_server_main.c +++ b/examples/tcp_ipc_server/tcp_ipc_server_main.c @@ -29,7 +29,7 @@ * IMPORTANT NOTE: * In order to test client_tcp & server_tcp together, there are two * ways to proceed: - * 1) Init server manually (command: SERVER &), and after successfull + * 1) Init server manually (command: SERVER &), and after successful * server init, also init client manually (CLIENT 127.0.0.1) * 2) init server automatically after boot using NuttShell start up scripts. */ @@ -97,7 +97,7 @@ static void *thread_socket_client(void *arg); /**************************************************************************** * Name: thread_socket_client - * Description: socket client thread. Each sonnected cleint socket will + * Description: socket client thread. Each connected client socket will * instantiate a thread, which handles all data traffic between * this client and server. * Parameters: thread arguments (in this case, file descriptor of client @@ -159,7 +159,7 @@ static void *thread_socket_client(void *arg) } else { - printf("ERROR: invalid message size (<0)\n"); + printf("ERROR: invalid message size (<0)\n"); } } } diff --git a/examples/xmlrpc/xmlrpc_main.c b/examples/xmlrpc/xmlrpc_main.c index f170d7fc5..595cb84eb 100644 --- a/examples/xmlrpc/xmlrpc_main.c +++ b/examples/xmlrpc/xmlrpc_main.c @@ -220,7 +220,9 @@ static void xmlrpc_handler(int fd) ret = xmlrpc_getheader(buffer, "Content-Length:", value, sizeof(value)); if (ret > 0) - loadlen = atoi(value); + { + loadlen = atoi(value); + } } else { @@ -243,7 +245,9 @@ static void xmlrpc_handler(int fd) if (temp) { if (strlen(temp) - 4 == loadlen) - break; + { + break; + } } } while (1); diff --git a/netutils/ftpd/ftpd.c b/netutils/ftpd/ftpd.c index c62d9ca73..712c679c6 100644 --- a/netutils/ftpd/ftpd.c +++ b/netutils/ftpd/ftpd.c @@ -328,6 +328,7 @@ static FAR struct ftpd_account_s *ftpd_account_new(FAR const char *user, static void ftpd_account_free(FAR struct ftpd_account_s *account) { struct ftpd_account_s *prev; + DEBUGASSERT(account); /* Back up to the first entry in the list */ @@ -370,6 +371,7 @@ static int ftpd_account_setpassword(FAR struct ftpd_account_s *account, FAR const char *passwd) { FAR char *temp; + DEBUGASSERT(account); /* Make of copy of the password string (if it is non-null) */ @@ -406,6 +408,7 @@ static int ftpd_account_add(FAR struct ftpd_server_s *server, { FAR struct ftpd_account_s *head; FAR struct ftpd_account_s *tail; + DEBUGASSERT(server && account); /* Find the beginning of the list */ @@ -850,6 +853,7 @@ static int ftpd_rxpoll(int sd, int timeout) else if (ret < 0) { int errval = errno; + ninfo("poll() failed: %d\n", errval); return -errval; } @@ -892,6 +896,7 @@ static int ftpd_txpoll(int sd, int timeout) else if (ret < 0) { int errval = errno; + ninfo("poll() failed: %d\n", errval); return -errval; } @@ -939,6 +944,7 @@ static int ftpd_accept(int sd, FAR void *addr, FAR socklen_t *addrlen, if (acceptsd < 0) { int errval = errno; + nerr("ERROR: accept() failed: %d\n", errval); return -errval; } @@ -998,6 +1004,7 @@ static ssize_t ftpd_send(int sd, FAR const void *data, size_t size, if (timeout >= 0) { int status = ftpd_txpoll(sd, timeout); + if (status < 0) { ninfo("ftpd_rxpoll: %d\n", status); @@ -1011,6 +1018,7 @@ static ssize_t ftpd_send(int sd, FAR const void *data, size_t size, if (ret < 0) { int errval = errno; + nerr("ERROR: send() failed: %d\n", errval); return -errval; } @@ -1073,6 +1081,7 @@ static int ftpd_dataopen(FAR struct ftpd_session_s *session) if (session->data.sd < 0) { int errval = errno; + nerr("ERROR: socket() failed: %d\n", errval); ftpd_response(session->cmd.sd, session->txtimeout, g_respfmt1, 451, ' ', "Socket error !"); @@ -1086,6 +1095,7 @@ static int ftpd_dataopen(FAR struct ftpd_session_s *session) if (ret < 0) { int errval = errno; + nerr("ERROR: connect() failed: %d\n", errval); ftpd_response(session->cmd.sd, session->txtimeout, g_respfmt1, 451, ' ', "Connect error !"); @@ -1094,15 +1104,15 @@ static int ftpd_dataopen(FAR struct ftpd_session_s *session) } #ifdef CONFIG_NET_SOLINGER - { - struct linger ling; + { + struct linger ling; - memset(&ling, 0, sizeof(ling)); - ling.l_onoff = 1; - ling.l_linger = 4; - setsockopt(session->data.sd, SOL_SOCKET, SO_LINGER, &ling, - sizeof(ling)); - } + memset(&ling, 0, sizeof(ling)); + ling.l_onoff = 1; + ling.l_linger = 4; + setsockopt(session->data.sd, SOL_SOCKET, SO_LINGER, &ling, + sizeof(ling)); + } #endif return OK; @@ -1127,15 +1137,15 @@ static int ftpd_dataopen(FAR struct ftpd_session_s *session) session->data.sd = sd; #ifdef CONFIG_NET_SOLINGER - { - struct linger ling; - - memset(&ling, 0, sizeof(ling)); - ling.l_onoff = 1; - ling.l_linger = 4; - setsockopt(session->data.sd, SOL_SOCKET, SO_LINGER, - &ling, sizeof(ling)); - } + { + struct linger ling; + + memset(&ling, 0, sizeof(ling)); + ling.l_onoff = 1; + ling.l_linger = 4; + setsockopt(session->data.sd, SOL_SOCKET, SO_LINGER, + &ling, sizeof(ling)); + } #endif return OK; @@ -1229,11 +1239,12 @@ static FAR struct ftpd_server_s *ftpd_openserver(int port, return NULL; } - { - int reuse = 1; - setsockopt(server->sd, SOL_SOCKET, SO_REUSEADDR, - &reuse, sizeof(reuse)); - } + { + int reuse = 1; + + setsockopt(server->sd, SOL_SOCKET, SO_REUSEADDR, + &reuse, sizeof(reuse)); + } /* Bind the socket to the address */ @@ -1725,6 +1736,7 @@ static off_t ftpd_offsatoi(FAR const char *filename, off_t offset) if (outstream == NULL) { int errval = errno; + nerr("ERROR: Failed to open %s: %d\n", filename, errval); return -errval; } @@ -1820,7 +1832,7 @@ static int ftpd_stream(FAR struct ftpd_session_s *session, int cmdtype) case 1: /* stor */ oflags = O_CREAT | O_WRONLY; - break; + break; case 2: /* appe */ oflags = O_CREAT | O_WRONLY | O_APPEND; @@ -2010,6 +2022,7 @@ static int ftpd_stream(FAR struct ftpd_session_s *session, int cmdtype) /* Change to ascii */ size_t offset = 0; + buflen = 0; while (offset < ((size_t)rdbytes)) { @@ -2086,22 +2099,22 @@ static int ftpd_stream(FAR struct ftpd_session_s *session, int cmdtype) } errout_with_session:; - close(session->fd); - session->fd = -1; + close(session->fd); + session->fd = -1; - if (isnew && ret < 0) - { - unlink(path); - } + if (isnew && ret < 0) + { + unlink(path); + } errout_with_data:; - ftpd_dataclose(session); + ftpd_dataclose(session); errout_with_path: - free(abspath); + free(abspath); errout: - return ret; + return ret; } /**************************************************************************** @@ -2420,6 +2433,7 @@ static int fptd_listscan(FAR struct ftpd_session_s *session, FAR char *path, if (dir == NULL) { int errval = errno; + nerr("ERROR: opendir() failed: %d\n", errval); return -errval; } @@ -2633,34 +2647,34 @@ static int ftpd_command_type(FAR struct ftpd_session_s *session) { switch (toupper(session->param[0])) { - case 'A': - { - session->type = FTPD_SESSIONTYPE_A; - return ftpd_response(session->cmd.sd, session->txtimeout, - g_respfmt1, 200, ' ', "Type set to A"); - } - - case 'I': - { - session->type = FTPD_SESSIONTYPE_I; - return ftpd_response(session->cmd.sd, session->txtimeout, - g_respfmt1, 200, ' ', "Type set to I"); - } - - case 'L': - { - session->type = FTPD_SESSIONTYPE_L8; - return ftpd_response(session->cmd.sd, session->txtimeout, - g_respfmt1, 200, ' ', - "Type set to L (byte size 8)"); - } - - default: - { - session->type = FTPD_SESSIONTYPE_NONE; - return ftpd_response(session->cmd.sd, session->txtimeout, - g_respfmt1, 501, ' ', "Type unknown !"); - } + case 'A': + { + session->type = FTPD_SESSIONTYPE_A; + return ftpd_response(session->cmd.sd, session->txtimeout, + g_respfmt1, 200, ' ', "Type set to A"); + } + + case 'I': + { + session->type = FTPD_SESSIONTYPE_I; + return ftpd_response(session->cmd.sd, session->txtimeout, + g_respfmt1, 200, ' ', "Type set to I"); + } + + case 'L': + { + session->type = FTPD_SESSIONTYPE_L8; + return ftpd_response(session->cmd.sd, session->txtimeout, + g_respfmt1, 200, ' ', + "Type set to L (byte size 8)"); + } + + default: + { + session->type = FTPD_SESSIONTYPE_NONE; + return ftpd_response(session->cmd.sd, session->txtimeout, + g_respfmt1, 501, ' ', "Type unknown !"); + } } } else if (parmlen == 3) @@ -3324,6 +3338,7 @@ static int ftpd_command_epsv(FAR struct ftpd_session_s *session) { #if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY) int ipv6only = 0; + setsockopt(session->data.sd, IPPROTO_IPV6, IPV6_V6ONLY, &ipv6only, sizeof(ipv6only)); #endif @@ -3551,92 +3566,92 @@ static int ftpd_command_size(FAR struct ftpd_session_s *session) ret = 0; switch (session->type) { - case FTPD_SESSIONTYPE_NONE: - case FTPD_SESSIONTYPE_L8: - case FTPD_SESSIONTYPE_I: - { - status = stat(path, &st); - if (status < 0) - { - ret = ftpd_response(session->cmd.sd, session->txtimeout, - g_respfmt2, 550, ' ', session->param, - ": not a regular file."); - } - else if (!S_ISREG(st.st_mode)) - { - ret = ftpd_response(session->cmd.sd, session->txtimeout, - g_respfmt2, 550, ' ', session->param, - ": not a regular file."); - } - else - { - ret = ftpd_response(session->cmd.sd, session->txtimeout, - "%03u%c%llu\r\n", 213, ' ', - (unsigned long long)st.st_size); - } - } - break; + case FTPD_SESSIONTYPE_NONE: + case FTPD_SESSIONTYPE_L8: + case FTPD_SESSIONTYPE_I: + { + status = stat(path, &st); + if (status < 0) + { + ret = ftpd_response(session->cmd.sd, session->txtimeout, + g_respfmt2, 550, ' ', session->param, + ": not a regular file."); + } + else if (!S_ISREG(st.st_mode)) + { + ret = ftpd_response(session->cmd.sd, session->txtimeout, + g_respfmt2, 550, ' ', session->param, + ": not a regular file."); + } + else + { + ret = ftpd_response(session->cmd.sd, session->txtimeout, + "%03u%c%llu\r\n", 213, ' ', + (unsigned long long)st.st_size); + } + } + break; - case FTPD_SESSIONTYPE_A: - { - status = stat(path, &st); - if (status < 0) - { - ret = -errno; - ftpd_response(session->cmd.sd, session->txtimeout, - g_respfmt2, 550, ' ', session->param, - ": not a regular file."); - goto errout_with_abspath; - } - else if (!S_ISREG(st.st_mode)) - { - ret = -EPERM; - ftpd_response(session->cmd.sd, session->txtimeout, - g_respfmt2, 550, ' ', session->param, - ": not a regular file."); - goto errout_with_abspath; - } - - outstream = fopen(path, "r"); - if (outstream == NULL) - { - ret = -errno; - ftpd_response(session->cmd.sd, session->txtimeout, - g_respfmt2, 550, ' ', session->param, - ": Can not open file !"); - goto errout_with_abspath; - } - - offset = 0; - for (; ; ) - { - ch = getc(outstream); - if (ch == EOF) - { - break; - } - else if (ch == 'c') - { - offset++; - } - - offset++; - } - - fclose(outstream); - ret = ftpd_response(session->cmd.sd, session->txtimeout, - "%03u%c%llu\r\n", 213, ' ', - (unsigned long long)offset); - } - break; + case FTPD_SESSIONTYPE_A: + { + status = stat(path, &st); + if (status < 0) + { + ret = -errno; + ftpd_response(session->cmd.sd, session->txtimeout, + g_respfmt2, 550, ' ', session->param, + ": not a regular file."); + goto errout_with_abspath; + } + else if (!S_ISREG(st.st_mode)) + { + ret = -EPERM; + ftpd_response(session->cmd.sd, session->txtimeout, + g_respfmt2, 550, ' ', session->param, + ": not a regular file."); + goto errout_with_abspath; + } - default: - { - ret = ftpd_response(session->cmd.sd, session->txtimeout, - g_respfmt1, 504, ' ', - "SIZE not implemented for type"); - } - break; + outstream = fopen(path, "r"); + if (outstream == NULL) + { + ret = -errno; + ftpd_response(session->cmd.sd, session->txtimeout, + g_respfmt2, 550, ' ', session->param, + ": Can not open file !"); + goto errout_with_abspath; + } + + offset = 0; + for (; ; ) + { + ch = getc(outstream); + if (ch == EOF) + { + break; + } + else if (ch == 'c') + { + offset++; + } + + offset++; + } + + fclose(outstream); + ret = ftpd_response(session->cmd.sd, session->txtimeout, + "%03u%c%llu\r\n", 213, ' ', + (unsigned long long)offset); + } + break; + + default: + { + ret = ftpd_response(session->cmd.sd, session->txtimeout, + g_respfmt1, 504, ' ', + "SIZE not implemented for type"); + } + break; } errout_with_abspath: @@ -4522,6 +4537,7 @@ errout: void ftpd_close(FTPD_SESSION handle) { struct ftpd_server_s *server; + DEBUGASSERT(handle); server = (struct ftpd_server_s *)handle; diff --git a/netutils/webserver/httpd.c b/netutils/webserver/httpd.c index 1cc8d58fc..45e5908ba 100644 --- a/netutils/webserver/httpd.c +++ b/netutils/webserver/httpd.c @@ -224,6 +224,7 @@ static void httpd_dumppstate(struct httpd_state *pstate, const char *msg) static void next_scriptstate(struct httpd_state *pstate) { char *p; + p = strchr(pstate->ht_scriptptr, ISO_NL) + 1; pstate->ht_scriptlen -= (unsigned short)(p - pstate->ht_scriptptr); pstate->ht_scriptptr = p; @@ -429,20 +430,20 @@ static int httpd_sendfile(struct httpd_state *pstate) ninfo("[%d] sending file '%s'\n", pstate->ht_sockfd, pstate->ht_filename); #ifdef CONFIG_NETUTILS_HTTPD_CGIPATH - { - httpd_cgifunction f; + { + httpd_cgifunction f; - f = httpd_cgi(pstate->ht_filename); - if (f != NULL) - { + f = httpd_cgi(pstate->ht_filename); + if (f != NULL) + { #ifndef CONFIG_NETUTILS_HTTPD_KEEPALIVE_DISABLE - pstate->ht_keepalive = false; + pstate->ht_keepalive = false; #endif - f(pstate, pstate->ht_filename); + f(pstate, pstate->ht_filename); - return OK; - } - } + return OK; + } + } #endif if (httpd_openindex(pstate) != OK) @@ -521,34 +522,34 @@ static inline int httpd_parse(struct httpd_state *pstate) return 413; } - { - ssize_t r; + { + ssize_t r; - r = recv(pstate->ht_sockfd, o, - sizeof pstate->ht_buffer - (o - pstate->ht_buffer), 0); - if (r == 0) - { - nwarn("WARNING: [%d] connection lost\n", pstate->ht_sockfd); - return ERROR; - } + r = recv(pstate->ht_sockfd, o, + sizeof pstate->ht_buffer - (o - pstate->ht_buffer), 0); + if (r == 0) + { + nwarn("WARNING: [%d] connection lost\n", pstate->ht_sockfd); + return ERROR; + } #if CONFIG_NETUTILS_HTTPD_TIMEOUT > 0 - if (r == -1 && errno == EWOULDBLOCK) - { - nwarn("WARNING: recv timeout\n"); - return 408; - } + if (r == -1 && errno == EWOULDBLOCK) + { + nwarn("WARNING: recv timeout\n"); + return 408; + } #endif - if (r == -1) - { - nerr("ERROR: [%d] recv failed: %d\n", - pstate->ht_sockfd, errno); - return 400; - } + if (r == -1) + { + nerr("ERROR: [%d] recv failed: %d\n", + pstate->ht_sockfd, errno); + return 400; + } - o += r; - } + o += r; + } /* Here o marks the end of the total block currently awaiting * processing. There may be multiple lines in a block; next we deal @@ -559,6 +560,8 @@ static inline int httpd_parse(struct httpd_state *pstate) (end = memchr(start, '\r', o - start)), end != NULL; start = end) { + char *v; + *end = '\0'; end++; @@ -575,82 +578,82 @@ static inline int httpd_parse(struct httpd_state *pstate) end++; switch (state) - { - char *v; - - case STATE_METHOD: - if (0 != strncmp(start, "GET ", 4)) - { - nwarn("WARNING: method not supported\n"); - return 501; - } - - start += 4; - v = start + strcspn(start, " "); - - if (0 != strcmp(v, " HTTP/1.0") && 0 != strcmp(v, " HTTP/1.1")) - { - nwarn("WARNING: HTTP version not supported\n"); - return 505; - } - - /* TODO: url decoding */ - - if (v - start >= sizeof pstate->ht_filename) - { - nerr("ERROR: ht_filename overflow\n"); - return 414; - } - - *v = '\0'; - strlcpy(pstate->ht_filename, start, sizeof(pstate->ht_filename)); - state = STATE_HEADER; - break; - - case STATE_HEADER: - if (*start == '\0') - { - state = STATE_BODY; + { + case STATE_METHOD: + if (0 != strncmp(start, "GET ", 4)) + { + nwarn("WARNING: method not supported\n"); + return 501; + } + + start += 4; + v = start + strcspn(start, " "); + + if (0 != strcmp(v, " HTTP/1.0") && + 0 != strcmp(v, " HTTP/1.1")) + { + nwarn("WARNING: HTTP version not supported\n"); + return 505; + } + + /* TODO: url decoding */ + + if (v - start >= sizeof pstate->ht_filename) + { + nerr("ERROR: ht_filename overflow\n"); + return 414; + } + + *v = '\0'; + strlcpy(pstate->ht_filename, start, + sizeof(pstate->ht_filename)); + state = STATE_HEADER; break; - } - - v = start + strcspn(start, ":"); - if (*v != '\0') - { - *v = '\0', v++; - v += strspn(v, ": "); - } - - if (*start == '\0' || *v == '\0') - { - nwarn("WARNING: header parse error\n"); - return 400; - } - - ninfo("[%d] Request header %s: %s\n", - pstate->ht_sockfd, start, v); - - if (0 == strcasecmp(start, "Content-Length") && 0 != atoi(v)) - { - nwarn("WARNING: non-zero request length\n"); - return 413; - } + + case STATE_HEADER: + if (*start == '\0') + { + state = STATE_BODY; + break; + } + + v = start + strcspn(start, ":"); + if (*v != '\0') + { + *v = '\0', v++; + v += strspn(v, ": "); + } + + if (*start == '\0' || *v == '\0') + { + nwarn("WARNING: header parse error\n"); + return 400; + } + + ninfo("[%d] Request header %s: %s\n", + pstate->ht_sockfd, start, v); + + if (0 == strcasecmp(start, "Content-Length") && 0 != atoi(v)) + { + nwarn("WARNING: non-zero request length\n"); + return 413; + } #ifndef CONFIG_NETUTILS_HTTPD_KEEPALIVE_DISABLE - else if (0 == strcasecmp(start, "Connection") && - 0 == strcasecmp(v, "keep-alive")) - { - pstate->ht_keepalive = true; - } + else if (0 == strcasecmp(start, "Connection") && + 0 == strcasecmp(v, "keep-alive")) + { + pstate->ht_keepalive = true; + } #endif - break; + break; - case STATE_BODY: + case STATE_BODY: - /* Not implemented */ + /* Not implemented */ - break; - } - } + break; + } + } /* Shuffle down for the next block */ @@ -866,6 +869,7 @@ int httpd_send_datachunk(int sockfd, void *data, int len, bool chunked) { int chunked_info_len = snprintf(chunked_info, HTTPD_MAX_CHUNKEDLEN, "%X\r\n", len); + ret = send(sockfd, chunked_info, chunked_info_len, 0); DEBUGASSERT(ret == chunked_info_len); } @@ -926,7 +930,7 @@ int httpd_send_headers(struct httpd_state *pstate, int status, int len) } a[] = - { + { #ifndef CONFIG_NETUTILS_HTTPD_SCRIPT_DISABLE { "shtml", "text/html" @@ -972,7 +976,7 @@ int httpd_send_headers(struct httpd_state *pstate, int status, int len) { "mp3", "audio/mpeg" }, - }; + }; ptr = strrchr(pstate->ht_filename, ISO_PERIOD); if (ptr == NULL) diff --git a/system/telnet/telnet_chatd.c b/system/telnet/telnet_chatd.c index 582bda725..5425f854c 100644 --- a/system/telnet/telnet_chatd.c +++ b/system/telnet/telnet_chatd.c @@ -302,49 +302,49 @@ static void _event_handler(struct telnet_s *telnet, switch (ev->type) { - /* Data received */ + /* Data received */ - case TELNET_EV_DATA: - _input(user, ev->data.buffer, ev->data.size); - telnet_negotiate(telnet, TELNET_WONT, TELNET_TELOPT_ECHO); - telnet_negotiate(telnet, TELNET_WILL, TELNET_TELOPT_ECHO); - break; + case TELNET_EV_DATA: + _input(user, ev->data.buffer, ev->data.size); + telnet_negotiate(telnet, TELNET_WONT, TELNET_TELOPT_ECHO); + telnet_negotiate(telnet, TELNET_WILL, TELNET_TELOPT_ECHO); + break; - /* Data must be sent */ + /* Data must be sent */ - case TELNET_EV_SEND: - _send(user->sock, ev->data.buffer, ev->data.size); - break; + case TELNET_EV_SEND: + _send(user->sock, ev->data.buffer, ev->data.size); + break; - /* Enable compress2 if accepted by client */ + /* Enable compress2 if accepted by client */ - case TELNET_EV_DO: - if (ev->neg.telopt == TELNET_TELOPT_COMPRESS2) - { - telnet_begin_compress2(telnet); - } - break; + case TELNET_EV_DO: + if (ev->neg.telopt == TELNET_TELOPT_COMPRESS2) + { + telnet_begin_compress2(telnet); + } + break; - /* Error */ + /* Error */ - case TELNET_EV_ERROR: - close(user->sock); - user->sock = -1; - if (user->name != 0) - { - _message(user->name, "** HAS HAD AN ERROR **"); - free(user->name); - user->name = 0; - } + case TELNET_EV_ERROR: + close(user->sock); + user->sock = -1; + if (user->name != 0) + { + _message(user->name, "** HAS HAD AN ERROR **"); + free(user->name); + user->name = 0; + } - telnet_free(user->telnet); - break; + telnet_free(user->telnet); + break; - default: + default: - /* Ignore */ + /* Ignore */ - break; + break; } }
