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

@@ -1,7 +1,8 @@
/****************************************************************************
* apps/nshlib/nsh_console.c
*
* Copyright (C) 2007-2009, 2011-2013, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011-2013, 2015 Gregory Nutt.
* All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -180,9 +181,9 @@ static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl,
*/
if (nsh_openifnotopen(pstate) != 0)
{
return (ssize_t)ERROR;
}
{
return ERROR;
}
/* Write the data to the output stream */
@@ -221,9 +222,9 @@ static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl,
*/
if (nsh_openifnotopen(pstate) != 0)
{
return ERROR;
}
{
return ERROR;
}
va_start(ap, fmt);
ret = vfprintf(pstate->cn_outstream, fmt, ap);
@@ -253,9 +254,9 @@ static int nsh_erroroutput(FAR struct nsh_vtbl_s *vtbl,
*/
if (nsh_openifnotopen(pstate) != 0)
{
return ERROR;
}
{
return ERROR;
}
va_start(ap, fmt);
ret = vfprintf(pstate->cn_errstream, fmt, ap);