Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apps/system: replace CONFIG_NSH_LINELEN to LINE_MAX #2918

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/lp503x/lp503x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,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;
Expand Down
2 changes: 1 addition & 1 deletion netutils/rexec/rexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion nshlib/nsh.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@
/* Maximum size of one command line (telnet or serial) */

#ifndef CONFIG_NSH_LINELEN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's remove CONFIG_NSH_LINELEN directly

# define CONFIG_NSH_LINELEN 80
# define CONFIG_NSH_LINELEN LINE_MAX
#endif

/* The maximum number of nested if-then[-else]-fi sequences that
Expand Down
2 changes: 1 addition & 1 deletion system/nxcamera/nxcamera_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,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;
Expand Down
2 changes: 1 addition & 1 deletion system/nxlooper/nxlooper_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,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;
Expand Down
2 changes: 1 addition & 1 deletion system/nxplayer/nxplayer_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,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;
Expand Down
2 changes: 1 addition & 1 deletion system/nxrecorder/nxrecorder_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,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;
Expand Down
14 changes: 2 additions & 12 deletions system/readline/readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,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
****************************************************************************/
Expand All @@ -57,14 +47,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);
Expand Down
4 changes: 2 additions & 2 deletions system/taskset/taskset.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,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;
Expand Down Expand Up @@ -151,7 +151,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++)
Expand Down
2 changes: 1 addition & 1 deletion system/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,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;

Expand Down
Loading