mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
apps/system: replace CONFIG_NSH_LINELEN to LINE_MAX
Applications should not depend on any properties of nshlib Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
parent
2df2534898
commit
66231194be
10 changed files with 12 additions and 22 deletions
|
|
@ -626,7 +626,7 @@ static int lp503x_cmd_help(FAR char *parg)
|
|||
int main(int argc, FAR char *argv[])
|
||||
{
|
||||
bool running;
|
||||
char buffer[CONFIG_NSH_LINELEN];
|
||||
char buffer[LINE_MAX];
|
||||
int len;
|
||||
int x;
|
||||
char *cmd;
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ static int do_rexec(FAR struct rexec_arg_s *arg)
|
|||
|
||||
int main(int argc, FAR char **argv)
|
||||
{
|
||||
char cmd[CONFIG_NSH_LINELEN];
|
||||
char cmd[LINE_MAX];
|
||||
struct rexec_arg_s arg;
|
||||
int option;
|
||||
int i;
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@
|
|||
/* Maximum size of one command line (telnet or serial) */
|
||||
|
||||
#ifndef CONFIG_NSH_LINELEN
|
||||
# define CONFIG_NSH_LINELEN 80
|
||||
# define CONFIG_NSH_LINELEN LINE_MAX
|
||||
#endif
|
||||
|
||||
/* The maximum number of nested if-then[-else]-fi sequences that
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ static int nxcamera_cmd_help(FAR struct nxcamera_s *pcam, FAR char *parg)
|
|||
|
||||
int main(int argc, FAR char *argv[])
|
||||
{
|
||||
char buffer[CONFIG_NSH_LINELEN];
|
||||
char buffer[LINE_MAX];
|
||||
int len;
|
||||
int x;
|
||||
bool running = true;
|
||||
|
|
|
|||
|
|
@ -502,7 +502,7 @@ static int nxlooper_cmd_help(FAR struct nxlooper_s *plooper, char *parg)
|
|||
|
||||
int main(int argc, FAR char *argv[])
|
||||
{
|
||||
char buffer[CONFIG_NSH_LINELEN];
|
||||
char buffer[LINE_MAX];
|
||||
int len;
|
||||
int x;
|
||||
int running;
|
||||
|
|
|
|||
|
|
@ -739,7 +739,7 @@ static int nxplayer_cmd_help(FAR struct nxplayer_s *pplayer, char *parg)
|
|||
|
||||
int main(int argc, FAR char *argv[])
|
||||
{
|
||||
char buffer[CONFIG_NSH_LINELEN];
|
||||
char buffer[LINE_MAX];
|
||||
int len;
|
||||
int x;
|
||||
int running;
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ static int nxrecorder_cmd_help(FAR struct nxrecorder_s *precorder,
|
|||
|
||||
int main(int argc, FAR char *argv[])
|
||||
{
|
||||
char buffer[CONFIG_NSH_LINELEN];
|
||||
char buffer[LINE_MAX];
|
||||
int len;
|
||||
int x;
|
||||
int running;
|
||||
|
|
|
|||
|
|
@ -32,16 +32,6 @@
|
|||
|
||||
#include "system/readline.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Maximum size of one command line (telnet or serial) */
|
||||
|
||||
#ifndef CONFIG_NSH_LINELEN
|
||||
# define CONFIG_NSH_LINELEN 80
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
|
@ -59,14 +49,14 @@
|
|||
|
||||
FAR char *readline(FAR const char *prompt)
|
||||
{
|
||||
FAR char *line = malloc(CONFIG_NSH_LINELEN);
|
||||
FAR char *line = malloc(LINE_MAX);
|
||||
|
||||
if (line != NULL)
|
||||
{
|
||||
#ifdef CONFIG_READLINE_TABCOMPLETION
|
||||
FAR const char *orig = readline_prompt(prompt);
|
||||
#endif
|
||||
if (readline_fd(line, CONFIG_NSH_LINELEN,
|
||||
if (readline_fd(line, LINE_MAX,
|
||||
STDIN_FILENO, STDOUT_FILENO) == 0)
|
||||
{
|
||||
free(line);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ static bool get_cpuset(const char *arg, cpu_set_t *cpu_set)
|
|||
|
||||
int main(int argc, FAR char *argv[])
|
||||
{
|
||||
char command[CONFIG_NSH_LINELEN];
|
||||
char command[LINE_MAX];
|
||||
int exitcode;
|
||||
int option;
|
||||
int pid = -1;
|
||||
|
|
@ -153,7 +153,7 @@ int main(int argc, FAR char *argv[])
|
|||
}
|
||||
|
||||
/* Construct actual command with args
|
||||
* NOTE: total length does not exceed CONFIG_NSH_LINELEN
|
||||
* NOTE: total length does not exceed LINE_MAX
|
||||
*/
|
||||
|
||||
for (i = 0; i < argc - 2; i++)
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ static int trace_cmd_dump(FAR const char *name, int index, int argc,
|
|||
static int trace_cmd_cmd(FAR const char *name, int index, int argc,
|
||||
FAR char **argv, int notectlfd)
|
||||
{
|
||||
char command[CONFIG_NSH_LINELEN];
|
||||
char command[LINE_MAX];
|
||||
bool changed;
|
||||
bool cont = false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue