diff options
Diffstat (limited to 'apps/nshlib')
-rw-r--r-- | apps/nshlib/Kconfig | 30 | ||||
-rw-r--r-- | apps/nshlib/nsh_session.c | 13 | ||||
-rw-r--r-- | apps/nshlib/nsh_stdsession.c | 13 |
3 files changed, 49 insertions, 7 deletions
diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig index 7fb6a52b3..8a9d1e900 100644 --- a/apps/nshlib/Kconfig +++ b/apps/nshlib/Kconfig @@ -6,13 +6,37 @@ config NSH_LIBRARY bool "NSH Library" default n - select SYSTEM_READLINE ---help--- - Build the NSH support library. This is used, for example, by examples/nsh - in order to implement the full NuttShell (NSH). + Build the NSH support library. This is used, for example, by + examples/nsh in order to implement the full NuttShell (NSH). if NSH_LIBRARY +choice + prompt "Command Line Editor" + default NSH_READLINE + +config NSH_READLINE + bool "Minimal readline()" + select SYSTEM_READLINE + ---help--- + Selects the minimal implementation of readline(). This minimal + implementation provides on backspace for command line editing. + +config NSH_CLE + bool "Command Line Editor" + select SYSTEM_CLE + ---help--- + Selects the more extensive, EMACS-like command line editor. + Select this option only if (1) you don't mind a modest increase + in the FLASH footprint, and (2) you work with a terminal that + support VT100 editing commands. + + Selecting this option will add probably 1.5-2KB to the FLASH + footprint. + +endchoice + config NSH_BUILTIN_APPS bool "Enable built-in applications" default n diff --git a/apps/nshlib/nsh_session.c b/apps/nshlib/nsh_session.c index 2272b1e30..de6710bfe 100644 --- a/apps/nshlib/nsh_session.c +++ b/apps/nshlib/nsh_session.c @@ -1,7 +1,7 @@ /**************************************************************************** * apps/nshlib/nsh_session.c * - * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,11 @@ #include <stdio.h> #include <stdlib.h> -#include <apps/readline.h> +#ifdef CONFIG_NSH_CLE +# include <apps/cle.h> +#else +# include <apps/readline.h> +#endif #include "nsh.h" #include "nsh_console.h" @@ -133,8 +137,13 @@ int nsh_session(FAR struct console_stdio_s *pstate) * or any read failure. */ +#ifdef CONFIG_NSH_CLE + ret = cle(pstate->cn_line, CONFIG_NSH_LINELEN, + INSTREAM(pstate), OUTSTREAM(pstate)); +#else ret = readline(pstate->cn_line, CONFIG_NSH_LINELEN, INSTREAM(pstate), OUTSTREAM(pstate)); +#endif if (ret != EOF) { /* Parse process the command */ diff --git a/apps/nshlib/nsh_stdsession.c b/apps/nshlib/nsh_stdsession.c index 11fae7db7..07def5b3b 100644 --- a/apps/nshlib/nsh_stdsession.c +++ b/apps/nshlib/nsh_stdsession.c @@ -1,7 +1,7 @@ /**************************************************************************** * apps/nshlib/nsh_stdsession.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,11 @@ #include <stdio.h> #include <stdlib.h> -#include <apps/readline.h> +#ifdef CONFIG_NSH_CLE +# include <apps/cle.h> +#else +# include <apps/readline.h> +#endif #include "nsh.h" #include "nsh_console.h" @@ -124,7 +128,12 @@ int nsh_session(FAR struct console_stdio_s *pstate) * or any read failure. */ +#ifdef CONFIG_NSH_CLE + ret = cle(pstate->cn_line, CONFIG_NSH_LINELEN, + stdin, stdout); +#else ret = std_readline(pstate->cn_line, CONFIG_NSH_LINELEN); +#endif if (ret != EOF) { /* Parse process the command */ |