nsh: Accept the command line arguments like sh

Usage: nsh [<script-path>|-c <command>]

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ifb76b27e7fd09d26b1f6e48c391fed0972018041
This commit is contained in:
Xiang Xiao
2020-08-17 18:28:50 +08:00
committed by David Sidrane
parent 78e8090842
commit 9d80399bd5
14 changed files with 203 additions and 182 deletions

View File

@@ -52,6 +52,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Method access macros */
#define nsh_clone(v) (v)->clone(v)
@@ -70,8 +71,9 @@
# define nsh_output vtbl->output
#endif
/* Size of info to be saved in call to nsh_redirect */
/* See struct serialsave_s in nsh_console.c */
/* Size of info to be saved in call to nsh_redirect
* See struct serialsave_s in nsh_console.c
*/
#define SAVE_SIZE (2 * sizeof(int) + 2 * sizeof(FILE*))
@@ -107,6 +109,7 @@
/****************************************************************************
* Public Types
****************************************************************************/
/* This describes a generic console front-end */
struct nsh_vtbl_s
@@ -129,10 +132,10 @@ struct nsh_vtbl_s
FAR char *(*linebuffer)(FAR struct nsh_vtbl_s *vtbl);
void (*redirect)(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save);
void (*undirect)(FAR struct nsh_vtbl_s *vtbl, FAR uint8_t *save);
void (*exit)(FAR struct nsh_vtbl_s *vtbl, int exitstatus) noreturn_function;
void (*exit)(FAR struct nsh_vtbl_s *vtbl, int status) noreturn_function;
#ifdef NSH_HAVE_IOBUFFER
/* Common buffer for file I/O. */
/* Common buffer for file I/O. */
char iobuffer[IOBUFFERSIZE];
#endif