NSH: All nsh_output strings tagged with IOBJ so that they may be stored in FLASH on AVR

This commit is contained in:
Gregory Nutt 2016-01-05 16:38:50 -06:00
parent 611bd4684f
commit cb6a914d08
4 changed files with 55 additions and 63 deletions

View File

@ -797,31 +797,31 @@ typedef CODE int (*nsh_direntry_handler_t)(FAR struct nsh_vtbl_s *vtbl,
* Public Data
****************************************************************************/
extern const char g_nshgreeting[];
extern const IOBJ char g_nshgreeting[];
#if defined(CONFIG_NSH_TELNET_LOGIN) && defined(CONFIG_NSH_TELNET)
extern const char g_telnetgreeting[];
extern const char g_userprompt[];
extern const char g_passwordprompt[];
extern const char g_loginsuccess[];
extern const char g_badcredentials[];
extern const char g_loginfailure[];
extern const IOBJ char g_telnetgreeting[];
extern const IOBJ char g_userprompt[];
extern const IOBJ char g_passwordprompt[];
extern const IOBJ char g_loginsuccess[];
extern const IOBJ char g_badcredentials[];
extern const IOBJ char g_loginfailure[];
#endif
extern const char g_nshprompt[];
extern const char g_nshsyntax[];
extern const char g_fmtargrequired[];
extern const char g_fmtnomatching[];
extern const char g_fmtarginvalid[];
extern const char g_fmtargrange[];
extern const char g_fmtcmdnotfound[];
extern const char g_fmtnosuch[];
extern const char g_fmttoomanyargs[];
extern const char g_fmtdeepnesting[];
extern const char g_fmtcontext[];
extern const char g_fmtcmdfailed[];
extern const char g_fmtcmdoutofmemory[];
extern const char g_fmtinternalerror[];
extern const IOBJ char g_nshprompt[];
extern const IOBJ char g_nshsyntax[];
extern const IOBJ char g_fmtargrequired[];
extern const IOBJ char g_fmtnomatching[];
extern const IOBJ char g_fmtarginvalid[];
extern const IOBJ char g_fmtargrange[];
extern const IOBJ char g_fmtcmdnotfound[];
extern const IOBJ char g_fmtnosuch[];
extern const IOBJ char g_fmttoomanyargs[];
extern const IOBJ char g_fmtdeepnesting[];
extern const IOBJ char g_fmtcontext[];
extern const IOBJ char g_fmtcmdfailed[];
extern const IOBJ char g_fmtcmdoutofmemory[];
extern const IOBJ char g_fmtinternalerror[];
#ifndef CONFIG_DISABLE_SIGNALS
extern const char g_fmtsignalrecvd[];
extern const IOBJ char g_fmtsignalrecvd[];
#endif
/****************************************************************************

View File

@ -53,10 +53,6 @@
#include "nsh.h"
#include "nsh_console.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
@ -93,14 +89,6 @@ static void nsh_consoleundirect(FAR struct nsh_vtbl_s *vtbl,
static void nsh_consoleexit(FAR struct nsh_vtbl_s *vtbl, int exitstatus)
noreturn_function;
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
@ -173,7 +161,8 @@ static void nsh_closeifnotclosed(struct console_stdio_s *pstate)
*
****************************************************************************/
static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl, FAR const void *buffer, size_t nbytes)
static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl,
FAR const void *buffer, size_t nbytes)
{
#if CONFIG_NFILE_DESCRIPTORS > 0
FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl;
@ -214,7 +203,7 @@ static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl, FAR const void *buf
****************************************************************************/
static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl,
FAR const char *fmt, ...)
FAR const IPTR char *fmt, ...)
{
#if CONFIG_NFILE_DESCRIPTORS > 0
FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl;
@ -442,7 +431,9 @@ static void nsh_consoleexit(FAR struct nsh_vtbl_s *vtbl, int exitstatus)
FAR struct console_stdio_s *nsh_newconsole(void)
{
struct console_stdio_s *pstate = (struct console_stdio_s *)zalloc(sizeof(struct console_stdio_s));
FAR struct console_stdio_s *pstate =
(FAR struct console_stdio_s *)zalloc(sizeof(struct console_stdio_s));
if (pstate)
{
/* Initialize the call table */

View File

@ -114,8 +114,9 @@ struct nsh_vtbl_s
void (*addref)(FAR struct nsh_vtbl_s *vtbl);
void (*release)(FAR struct nsh_vtbl_s *vtbl);
#endif
ssize_t (*write)(FAR struct nsh_vtbl_s *vtbl, FAR const void *buffer, size_t nbytes);
int (*output)(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...);
ssize_t (*write)(FAR struct nsh_vtbl_s *vtbl, FAR const void *buffer,
size_t nbytes);
int (*output)(FAR struct nsh_vtbl_s *vtbl, FAR const IOBJ char *fmt, ...);
FAR char *(*linebuffer)(FAR struct nsh_vtbl_s *vtbl);
#if CONFIG_NFILE_DESCRIPTORS > 0
void (*redirect)(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save);

View File

@ -219,47 +219,47 @@ static const char g_nullstring[] = "";
*/
#if CONFIG_VERSION_MAJOR != 0 || CONFIG_VERSION_MINOR != 0
const char g_nshgreeting[] = "\nNuttShell (NSH) NuttX-" CONFIG_VERSION_STRING "\n";
const IOBJ char g_nshgreeting[] = "\nNuttShell (NSH) NuttX-" CONFIG_VERSION_STRING "\n";
#else
const char g_nshgreeting[] = "\nNuttShell (NSH)\n";
const IOBJ char g_nshgreeting[] = "\nNuttShell (NSH)\n";
#endif
/* Telnet login prompts */
#if defined(CONFIG_NSH_TELNET_LOGIN) && defined(CONFIG_NSH_TELNET)
const char g_telnetgreeting[] = "\nWelcome to NuttShell(NSH) Telnet Server...\n";
const char g_userprompt[] = "login: ";
const char g_passwordprompt[] = "password: ";
const char g_loginsuccess[] = "\nUser Logged-in!\n";
const char g_badcredentials[] = "\nInvalid username or password\n";
const char g_loginfailure[] = "Login failed!\n";
const IOBJ char g_telnetgreeting[] = "\nWelcome to NuttShell(NSH) Telnet Server...\n";
const IOBJ char g_userprompt[] = "login: ";
const IOBJ char g_passwordprompt[] = "password: ";
const IOBJ char g_loginsuccess[] = "\nUser Logged-in!\n";
const IOBJ char g_badcredentials[] = "\nInvalid username or password\n";
const IOBJ char g_loginfailure[] = "Login failed!\n";
#endif
/* The NSH prompt */
const char g_nshprompt[] = "nsh> ";
const IOBJ char g_nshprompt[] = "nsh> ";
/* Common, message formats */
const char g_nshsyntax[] = "nsh: %s: syntax error\n";
const char g_fmtargrequired[] = "nsh: %s: missing required argument(s)\n";
const char g_fmtnomatching[] = "nsh: %s: no matching %s\n";
const char g_fmtarginvalid[] = "nsh: %s: argument invalid\n";
const char g_fmtargrange[] = "nsh: %s: value out of range\n";
const char g_fmtcmdnotfound[] = "nsh: %s: command not found\n";
const char g_fmtnosuch[] = "nsh: %s: no such %s: %s\n";
const char g_fmttoomanyargs[] = "nsh: %s: too many arguments\n";
const char g_fmtdeepnesting[] = "nsh: %s: nesting too deep\n";
const char g_fmtcontext[] = "nsh: %s: not valid in this context\n";
const IOBJ char g_nshsyntax[] = "nsh: %s: syntax error\n";
const IOBJ char g_fmtargrequired[] = "nsh: %s: missing required argument(s)\n";
const IOBJ char g_fmtnomatching[] = "nsh: %s: no matching %s\n";
const IOBJ char g_fmtarginvalid[] = "nsh: %s: argument invalid\n";
const IOBJ char g_fmtargrange[] = "nsh: %s: value out of range\n";
const IOBJ char g_fmtcmdnotfound[] = "nsh: %s: command not found\n";
const IOBJ char g_fmtnosuch[] = "nsh: %s: no such %s: %s\n";
const IOBJ char g_fmttoomanyargs[] = "nsh: %s: too many arguments\n";
const IOBJ char g_fmtdeepnesting[] = "nsh: %s: nesting too deep\n";
const IOBJ char g_fmtcontext[] = "nsh: %s: not valid in this context\n";
#ifdef CONFIG_NSH_STRERROR
const char g_fmtcmdfailed[] = "nsh: %s: %s failed: %s\n";
const IOBJ char g_fmtcmdfailed[] = "nsh: %s: %s failed: %s\n";
#else
const char g_fmtcmdfailed[] = "nsh: %s: %s failed: %d\n";
const IOBJ char g_fmtcmdfailed[] = "nsh: %s: %s failed: %d\n";
#endif
const char g_fmtcmdoutofmemory[] = "nsh: %s: out of memory\n";
const char g_fmtinternalerror[] = "nsh: %s: Internal error\n";
const IOBJ char g_fmtcmdoutofmemory[] = "nsh: %s: out of memory\n";
const IOBJ char g_fmtinternalerror[] = "nsh: %s: Internal error\n";
#ifndef CONFIG_DISABLE_SIGNALS
const char g_fmtsignalrecvd[] = "nsh: %s: Interrupted by signal\n";
const IOBJ char g_fmtsignalrecvd[] = "nsh: %s: Interrupted by signal\n";
#endif
/****************************************************************************