Fixing coding style issues for rest of nshlib directory - except for the false +ve nsh_timcmds.c

This commit is contained in:
Subhra Sankha Sarkar
2020-11-02 17:00:26 +05:30
committed by Alin Jerpelea
parent 0f4ad7dc5f
commit 3b884cfb87
5 changed files with 99 additions and 93 deletions

View File

@@ -355,6 +355,7 @@ int cmd_addroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
} }
} }
#endif #endif
rtrndx = 2; rtrndx = 2;
} }
else else

View File

@@ -341,7 +341,8 @@ int cmd_reboot(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#if defined(CONFIG_RPTUN) && !defined(CONFIG_NSH_DISABLE_RPTUN) #if defined(CONFIG_RPTUN) && !defined(CONFIG_NSH_DISABLE_RPTUN)
int cmd_rptun(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) int cmd_rptun(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{ {
int fd, cmd; int fd;
int cmd;
if (argc < 3) if (argc < 3)
{ {

View File

@@ -70,7 +70,8 @@
* Name: nsh_telnetecho * Name: nsh_telnetecho
****************************************************************************/ ****************************************************************************/
static void nsh_telnetecho(FAR struct console_stdio_s *pstate, uint8_t is_use) static void nsh_telnetecho(FAR struct console_stdio_s *pstate,
uint8_t is_use)
{ {
uint8_t optbuf[4]; uint8_t optbuf[4];
optbuf[0] = TELNET_IAC; optbuf[0] = TELNET_IAC;
@@ -193,7 +194,8 @@ int nsh_telnetlogin(FAR struct console_stdio_s *pstate)
fflush(pstate->cn_outstream); fflush(pstate->cn_outstream);
username[0] = '\0'; username[0] = '\0';
if (fgets(pstate->cn_line, CONFIG_NSH_LINELEN, INSTREAM(pstate)) != NULL) if (fgets(pstate->cn_line, CONFIG_NSH_LINELEN,
INSTREAM(pstate)) != NULL)
{ {
/* Parse out the username */ /* Parse out the username */
@@ -207,7 +209,8 @@ int nsh_telnetlogin(FAR struct console_stdio_s *pstate)
nsh_telnetecho(pstate, TELNET_NOTUSE_ECHO); nsh_telnetecho(pstate, TELNET_NOTUSE_ECHO);
password[0] = '\0'; password[0] = '\0';
if (fgets(pstate->cn_line, CONFIG_NSH_LINELEN, INSTREAM(pstate)) != NULL) if (fgets(pstate->cn_line, CONFIG_NSH_LINELEN,
INSTREAM(pstate)) != NULL)
{ {
/* Parse out the password */ /* Parse out the password */
@@ -218,7 +221,8 @@ int nsh_telnetlogin(FAR struct console_stdio_s *pstate)
#if defined(CONFIG_NSH_LOGIN_PASSWD) #if defined(CONFIG_NSH_LOGIN_PASSWD)
if (PASSWORD_VERIFY_MATCH(passwd_verify(username, password))) if (PASSWORD_VERIFY_MATCH(passwd_verify(username, password)))
#elif defined(CONFIG_NSH_LOGIN_PLATFORM) #elif defined(CONFIG_NSH_LOGIN_PLATFORM)
if (PASSWORD_VERIFY_MATCH(platform_user_verify(username, password))) if (PASSWORD_VERIFY_MATCH(platform_user_verify(username,
password)))
#elif defined(CONFIG_NSH_LOGIN_FIXED) #elif defined(CONFIG_NSH_LOGIN_FIXED)
if (strcmp(password, CONFIG_NSH_LOGIN_PASSWORD) == 0 && if (strcmp(password, CONFIG_NSH_LOGIN_PASSWORD) == 0 &&
strcmp(username, CONFIG_NSH_LOGIN_USERNAME) == 0) strcmp(username, CONFIG_NSH_LOGIN_USERNAME) == 0)

View File

@@ -258,8 +258,8 @@ int nsh_setvar(FAR struct nsh_vtbl_s *vtbl, FAR const char *name,
nsh_removevar(pstate, pair); nsh_removevar(pstate, pair);
} }
/* Get the size of the new name=value string. The +2 is for the '=' and for /* Get the size of the new name=value string. The +2 is for the '=' and
* null terminator * for null terminator
*/ */
varlen = strlen(name) + strlen(value) + 2; varlen = strlen(name) + strlen(value) + 2;