diff --git a/nshlib/nsh.h b/nshlib/nsh.h index f040e0b16..cd0ea0e1a 100644 --- a/nshlib/nsh.h +++ b/nshlib/nsh.h @@ -379,12 +379,6 @@ # define NSH_HERRNO_OF(err) (err) #endif -/* Maximum size of one command line (telnet or serial) */ - -#ifndef CONFIG_NSH_LINELEN -# define CONFIG_NSH_LINELEN LINE_MAX -#endif - /* The maximum number of nested if-then[-else]-fi sequences that * are permissible. */ diff --git a/nshlib/nsh_console.h b/nshlib/nsh_console.h index 1a9ccf034..0b94a2b6b 100644 --- a/nshlib/nsh_console.h +++ b/nshlib/nsh_console.h @@ -188,7 +188,7 @@ struct console_stdio_s /* Line input buffer */ - char cn_line[CONFIG_NSH_LINELEN]; + char cn_line[LINE_MAX]; }; /**************************************************************************** diff --git a/nshlib/nsh_login.c b/nshlib/nsh_login.c index 74876fc3d..cde17f55c 100644 --- a/nshlib/nsh_login.c +++ b/nshlib/nsh_login.c @@ -173,7 +173,7 @@ int nsh_login(FAR struct console_stdio_s *pstate) /* readline() returns EOF on failure */ - ret = readline_fd(pstate->cn_line, CONFIG_NSH_LINELEN, + ret = readline_fd(pstate->cn_line, LINE_MAX, INFD(pstate), OUTFD(pstate)); if (ret != EOF) { @@ -209,8 +209,7 @@ int nsh_login(FAR struct console_stdio_s *pstate) } password[0] = '\0'; - ret = readline_fd(pstate->cn_line, CONFIG_NSH_LINELEN, - INFD(pstate), -1); + ret = readline_fd(pstate->cn_line, LINE_MAX, INFD(pstate), -1); /* Enable echo again after password */ diff --git a/nshlib/nsh_mmcmds.c b/nshlib/nsh_mmcmds.c index 518702b07..81427a00b 100644 --- a/nshlib/nsh_mmcmds.c +++ b/nshlib/nsh_mmcmds.c @@ -58,12 +58,12 @@ int cmd_free(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) int cmd_memdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) { - char arg[CONFIG_NSH_LINELEN] = ""; + char arg[LINE_MAX] = ""; int i; if (argc == 1) { - strlcpy(arg, "used", CONFIG_NSH_LINELEN); + strlcpy(arg, "used", LINE_MAX); } else if (argc >= 2 && (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "help") == 0)) @@ -75,10 +75,10 @@ int cmd_memdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) { for (i = 1; i < argc; i++) { - strlcat(arg, argv[i], CONFIG_NSH_LINELEN); + strlcat(arg, argv[i], LINE_MAX); if (i < argc - 1) { - strlcat(arg, " ", CONFIG_NSH_LINELEN); + strlcat(arg, " ", LINE_MAX); } } } diff --git a/nshlib/nsh_parse.c b/nshlib/nsh_parse.c index f6922b116..3ca731a00 100644 --- a/nshlib/nsh_parse.c +++ b/nshlib/nsh_parse.c @@ -607,7 +607,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl, { FAR char *sh_argv[4]; FAR char *sh_cmd = "sh"; - char sh_arg2[CONFIG_NSH_LINELEN]; + char sh_arg2[LINE_MAX]; DEBUGASSERT(strncmp(argv[0], sh_cmd, 3) != 0); @@ -2462,7 +2462,7 @@ static int nsh_parse_command(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline) #endif #ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP - char tracebuf[CONFIG_NSH_LINELEN + 1]; + char tracebuf[LINE_MAX + 1]; strlcpy(tracebuf, cmdline, sizeof(tracebuf)); sched_note_beginex(NOTE_TAG_APP, tracebuf); @@ -2685,7 +2685,7 @@ static int nsh_parse_command(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline) { FAR char *arg; FAR char *sh_argv[4]; - char sh_arg2[CONFIG_NSH_LINELEN]; + char sh_arg2[LINE_MAX]; if (argv[argc][g_pipeline1_len]) { diff --git a/nshlib/nsh_script.c b/nshlib/nsh_script.c index 52ab377a5..a049de624 100644 --- a/nshlib/nsh_script.c +++ b/nshlib/nsh_script.c @@ -163,7 +163,7 @@ int nsh_script(FAR struct nsh_vtbl_s *vtbl, FAR const FAR char *cmd, /* Now read the next line from the script file */ - ret = readline_fd(buffer, CONFIG_NSH_LINELEN, vtbl->np.np_fd, -1); + ret = readline_fd(buffer, LINE_MAX, vtbl->np.np_fd, -1); if (ret >= 0) { /* Parse process the command. NOTE: this is recursive... diff --git a/nshlib/nsh_session.c b/nshlib/nsh_session.c index 761f84a04..500c8d6f1 100644 --- a/nshlib/nsh_session.c +++ b/nshlib/nsh_session.c @@ -209,7 +209,7 @@ int nsh_session(FAR struct console_stdio_s *pstate, * occurs. Either will cause the session to terminate. */ - ret = cle_fd(pstate->cn_line, nsh_prompt(), CONFIG_NSH_LINELEN, + ret = cle_fd(pstate->cn_line, nsh_prompt(), LINE_MAX, INFD(pstate), OUTFD(pstate)); if (ret < 0) { @@ -227,7 +227,7 @@ int nsh_session(FAR struct console_stdio_s *pstate, * will cause the session to terminate. */ - ret = readline_fd(pstate->cn_line, CONFIG_NSH_LINELEN, + ret = readline_fd(pstate->cn_line, LINE_MAX, INFD(pstate), OUTFD(pstate)); if (ret == EOF) { diff --git a/nshlib/nsh_telnetlogin.c b/nshlib/nsh_telnetlogin.c index 9e23cbc26..417ffda68 100644 --- a/nshlib/nsh_telnetlogin.c +++ b/nshlib/nsh_telnetlogin.c @@ -178,7 +178,7 @@ int nsh_telnetlogin(FAR struct console_stdio_s *pstate) write(OUTFD(pstate), g_userprompt, strlen(g_userprompt)); username[0] = '\0'; - if (readline_fd(pstate->cn_line, CONFIG_NSH_LINELEN, + if (readline_fd(pstate->cn_line, LINE_MAX, INFD(pstate), OUTFD(pstate)) >= 0) { @@ -214,7 +214,7 @@ int nsh_telnetlogin(FAR struct console_stdio_s *pstate) } password[0] = '\0'; - ret = readline_fd(pstate->cn_line, CONFIG_NSH_LINELEN, + ret = readline_fd(pstate->cn_line, LINE_MAX, INFD(pstate), OUTFD(pstate)); /* Enable echo again after password */ diff --git a/nshlib/nsh_timcmds.c b/nshlib/nsh_timcmds.c index cd1bbc378..732bb512e 100644 --- a/nshlib/nsh_timcmds.c +++ b/nshlib/nsh_timcmds.c @@ -552,7 +552,7 @@ int cmd_timedatectl(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) #ifndef CONFIG_NSH_DISABLE_WATCH int cmd_watch(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) { - char buffer[CONFIG_NSH_LINELEN]; + char buffer[LINE_MAX]; int interval = 2; int count = -1; FAR char *cmd; @@ -595,7 +595,7 @@ int cmd_watch(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) for (i = 0; i < count; i++) { - strlcpy(buffer, cmd, CONFIG_NSH_LINELEN); + strlcpy(buffer, cmd, LINE_MAX); ret = nsh_parse(vtbl, buffer); if (ret < 0) {