Commit 039c85fb2aa20379cab4842a55db46aa0f75ce29
1 parent
95b628bd
Exists in
master
and in
2 other branches
Fixing LGTM warning.
Showing
1 changed file
with
14 additions
and
34 deletions
Show diff stats
src/core/telnet.c
@@ -124,19 +124,6 @@ | @@ -124,19 +124,6 @@ | ||
124 | #define E_OPT(n) (1 << (n)) | 124 | #define E_OPT(n) (1 << (n)) |
125 | #endif // X3270_TN3270E | 125 | #endif // X3270_TN3270E |
126 | 126 | ||
127 | -/* | ||
128 | -#if defined(X3270_ANSI) | ||
129 | -static char vintr; | ||
130 | -static char vquit; | ||
131 | -static char verase; | ||
132 | -static char vkill; | ||
133 | -static char veof; | ||
134 | -static char vwerase; | ||
135 | -static char vrprnt; | ||
136 | -static char vlnext; | ||
137 | -#endif | ||
138 | -*/ | ||
139 | - | ||
140 | struct _ansictl ansictl = { 0 }; | 127 | struct _ansictl ansictl = { 0 }; |
141 | 128 | ||
142 | static int telnet_fsm(H3270 *session, unsigned char c); | 129 | static int telnet_fsm(H3270 *session, unsigned char c); |
@@ -2090,27 +2077,23 @@ static void check_linemode(H3270 *hSession, Boolean init) | @@ -2090,27 +2077,23 @@ static void check_linemode(H3270 *hSession, Boolean init) | ||
2090 | } | 2077 | } |
2091 | } | 2078 | } |
2092 | 2079 | ||
2093 | - | ||
2094 | #if defined(X3270_TRACE) | 2080 | #if defined(X3270_TRACE) |
2095 | 2081 | ||
2096 | -/* | ||
2097 | - * nnn | ||
2098 | - * Expands a number to a character string, for displaying unknown telnet | ||
2099 | - * commands and options. | ||
2100 | - */ | 2082 | +/// |
2083 | +/// @brief Expands a number to a character string, for displaying unknown telnet commands and options. | ||
2084 | +/// | ||
2101 | static const char * | 2085 | static const char * |
2102 | nnn(int c) | 2086 | nnn(int c) |
2103 | { | 2087 | { |
2104 | static char buf[64]; | 2088 | static char buf[64]; |
2105 | - | ||
2106 | - (void) sprintf(buf, "%d", c); | 2089 | + memset(buf,0,sizeof(buf)); |
2090 | + (void) snprintf(buf, 63, "%d", c); | ||
2107 | return buf; | 2091 | return buf; |
2108 | } | 2092 | } |
2109 | 2093 | ||
2110 | -/* | ||
2111 | - * cmd | ||
2112 | - * Expands a TELNET command into a character string. | ||
2113 | - */ | 2094 | +/// |
2095 | +/// @brief Expands a TELNET command into a character string. | ||
2096 | +/// | ||
2114 | static const char * cmd(int c) | 2097 | static const char * cmd(int c) |
2115 | { | 2098 | { |
2116 | if (TELCMD_OK(c)) | 2099 | if (TELCMD_OK(c)) |
@@ -2119,20 +2102,17 @@ static const char * cmd(int c) | @@ -2119,20 +2102,17 @@ static const char * cmd(int c) | ||
2119 | return nnn(c); | 2102 | return nnn(c); |
2120 | } | 2103 | } |
2121 | 2104 | ||
2122 | -/*** | ||
2123 | - * | ||
2124 | - * @brief Expands a TELNET option into a character string. | ||
2125 | - */ | 2105 | +/// |
2106 | +/// @brief Expands a TELNET option into a character string. | ||
2107 | +/// | ||
2126 | static const char * opt(unsigned char c) | 2108 | static const char * opt(unsigned char c) |
2127 | { | 2109 | { |
2128 | - if (TELOPT_OK(c)) | ||
2129 | - return TELOPT(c); | ||
2130 | - else if (c == TELOPT_TN3270E) | 2110 | + if (c == TELOPT_TN3270E) |
2131 | return "TN3270E"; | 2111 | return "TN3270E"; |
2132 | -#if defined(HAVE_LIBSSL) /*[*/ | ||
2133 | else if (c == TELOPT_STARTTLS) | 2112 | else if (c == TELOPT_STARTTLS) |
2134 | return "START-TLS"; | 2113 | return "START-TLS"; |
2135 | -#endif /*]*/ | 2114 | + else if (TELOPT_OK(c)) |
2115 | + return TELOPT(c); | ||
2136 | else | 2116 | else |
2137 | return nnn((int)c); | 2117 | return nnn((int)c); |
2138 | } | 2118 | } |