Skip to content

Commit 26ff99a

Browse files
committed
telnet_console: fix syntax
Fix layout and syntax with uncrustify after changing to new logger. Signed-off-by: Anas Nashif <[email protected]>
1 parent 8965678 commit 26ff99a

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

drivers/console/telnet_console.c

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ LOG_MODULE_REGISTER(LOG_DOMAIN);
3434
#include "telnet_protocol.h"
3535

3636
/* Various definitions mapping the telnet service configuration options */
37-
#define TELNET_PORT CONFIG_TELNET_CONSOLE_PORT
38-
#define TELNET_STACK_SIZE CONFIG_TELNET_CONSOLE_THREAD_STACK
39-
#define TELNET_PRIORITY CONFIG_TELNET_CONSOLE_PRIO
40-
#define TELNET_LINES CONFIG_TELNET_CONSOLE_LINE_BUF_NUMBERS
41-
#define TELNET_LINE_SIZE CONFIG_TELNET_CONSOLE_LINE_BUF_SIZE
42-
#define TELNET_TIMEOUT K_MSEC(CONFIG_TELNET_CONSOLE_SEND_TIMEOUT)
43-
#define TELNET_THRESHOLD CONFIG_TELNET_CONSOLE_SEND_THRESHOLD
37+
#define TELNET_PORT CONFIG_TELNET_CONSOLE_PORT
38+
#define TELNET_STACK_SIZE CONFIG_TELNET_CONSOLE_THREAD_STACK
39+
#define TELNET_PRIORITY CONFIG_TELNET_CONSOLE_PRIO
40+
#define TELNET_LINES CONFIG_TELNET_CONSOLE_LINE_BUF_NUMBERS
41+
#define TELNET_LINE_SIZE CONFIG_TELNET_CONSOLE_LINE_BUF_SIZE
42+
#define TELNET_TIMEOUT K_MSEC(CONFIG_TELNET_CONSOLE_SEND_TIMEOUT)
43+
#define TELNET_THRESHOLD CONFIG_TELNET_CONSOLE_SEND_THRESHOLD
4444

45-
#define TELNET_MIN_MSG 2
45+
#define TELNET_MIN_MSG 2
4646

4747
/* These 2 structures below are used to store the console output
4848
* before sending it to the client. This is done to keep some
@@ -191,7 +191,7 @@ static int telnet_console_out(int c)
191191
lb->buf[lb->len++] = (char)c;
192192

193193
if (c == '\n' || lb->len == TELNET_LINE_SIZE - 1) {
194-
lb->buf[lb->len-1] = NVT_CR;
194+
lb->buf[lb->len - 1] = NVT_CR;
195195
lb->buf[lb->len++] = NVT_LF;
196196
telnet_rb_switch();
197197
yield = true;
@@ -314,8 +314,7 @@ static inline void telnet_reply_command(void)
314314
telnet_reply_do_command();
315315
break;
316316
default:
317-
LOG_DBG("Operation %u not handled",
318-
telnet_cmd.op);
317+
LOG_DBG("Operation %u not handled", telnet_cmd.op);
319318
break;
320319
}
321320

@@ -349,7 +348,7 @@ static inline bool telnet_handle_command(struct net_pkt *pkt)
349348
k_sem_give(&cmd_lock);
350349
k_sem_give(&send_lock);
351350
}
352-
#endif /* CONFIG_TELNET_CONSOLE_SUPPORT_COMMAND */
351+
#endif /* CONFIG_TELNET_CONSOLE_SUPPORT_COMMAND */
353352

354353
return true;
355354
}
@@ -381,13 +380,13 @@ static inline void telnet_handle_input(struct net_pkt *pkt)
381380
net_frag_read(pkt->frags, offset, &pos, len, (u8_t *)input->line);
382381

383382
/* LF/CR will be removed if only the line is not NUL terminated */
384-
if (input->line[len-1] != NVT_NUL) {
385-
if (input->line[len-1] == NVT_LF) {
386-
input->line[len-1] = NVT_NUL;
383+
if (input->line[len - 1] != NVT_NUL) {
384+
if (input->line[len - 1] == NVT_LF) {
385+
input->line[len - 1] = NVT_NUL;
387386
}
388387

389-
if (input->line[len-2] == NVT_CR) {
390-
input->line[len-2] = NVT_NUL;
388+
if (input->line[len - 2] == NVT_CR) {
389+
input->line[len - 2] = NVT_NUL;
391390
}
392391
}
393392

@@ -403,8 +402,8 @@ static void telnet_recv(struct net_context *client,
403402
telnet_end_client_connection();
404403

405404
LOG_DBG("Telnet client dropped (AF_INET%s) status %d",
406-
net_context_get_family(client) == AF_INET ?
407-
"" : "6", status);
405+
net_context_get_family(client) == AF_INET ?
406+
"" : "6", status);
408407
return;
409408
}
410409

@@ -445,7 +444,7 @@ static void telnet_accept(struct net_context *client,
445444

446445
if (net_context_recv(client, telnet_recv, 0, NULL)) {
447446
LOG_ERR("Unable to setup reception (family %u)",
448-
net_context_get_family(client));
447+
net_context_get_family(client));
449448
goto error;
450449
}
451450

@@ -454,7 +453,7 @@ static void telnet_accept(struct net_context *client,
454453
}
455454

456455
LOG_DBG("Telnet client connected (family AF_INET%s)",
457-
net_context_get_family(client) == AF_INET ? "" : "6");
456+
net_context_get_family(client) == AF_INET ? "" : "6");
458457

459458
orig_printk_hook = __printk_get_hook();
460459
__printk_hook_install(telnet_console_out);
@@ -477,7 +476,7 @@ static void telnet_setup_server(struct net_context **ctx, sa_family_t family,
477476

478477
if (net_context_bind(*ctx, addr, addrlen)) {
479478
LOG_ERR("Cannot bind on family AF_INET%s",
480-
family == AF_INET ? "" : "6");
479+
family == AF_INET ? "" : "6");
481480
goto error;
482481
}
483482

@@ -492,12 +491,12 @@ static void telnet_setup_server(struct net_context **ctx, sa_family_t family,
492491
}
493492

494493
LOG_DBG("Telnet console enabled on AF_INET%s",
495-
family == AF_INET ? "" : "6");
494+
family == AF_INET ? "" : "6");
496495

497496
return;
498497
error:
499498
LOG_ERR("Unable to start telnet on AF_INET%s",
500-
family == AF_INET ? "" : "6");
499+
family == AF_INET ? "" : "6");
501500

502501
if (*ctx) {
503502
net_context_put(*ctx);

0 commit comments

Comments
 (0)