Commit Graph

832 Commits

Author SHA1 Message Date
ligd
faa243844d apps: add variable to identify main shell
Change-Id: Ifecfbb58b3c2cdbeae900eb2eeb2b641155a7580
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-02 09:09:31 -07:00
liuhaitao
4b8e0fde62 nshlib: Add 'rm -r' recursive remove directory support
Change-Id: Iafecb0a25cc9d091a1aee8f381b217e67d6e3925
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-07-01 14:55:04 -07:00
Xiang Xiao
99e1674912 Call posix_spawn with filename as the first argv entry
pair with the kernel side change to follow the standard defintion:
https://pubs.opengroup.org/onlinepubs/009695399/functions/posix_spawn.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-14 07:12:54 -06:00
Alin Jerpelea
395b0094a5 nshlib: nxstyle fixes
fixes for errors reported by the nxstyle tool

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-11 02:42:05 -05:00
Alin Jerpelea
4f3f62c8fc nshlib: update licenses to Apache
Gregory Nutt is has submitted the SGA

Uros Platise has submitted the ICLA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-11 02:42:05 -05:00
Xiang Xiao
d9c1c5bbc8 Include assert.h in necessary place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-08 13:04:34 -07:00
David Sidrane
eef3e1e009 nshlib/vars: Add assert header 2021-06-08 13:19:50 -05:00
Alin Jerpelea
129aa55a36 nshlib: update licenses to Apache
Gregory Nutt is has submitted the SGA

Alan Carvalho de Assis has submitted the ICLA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-08 08:43:15 -05:00
Alin Jerpelea
ec339bc49a Makefiles: Gregory Nutt: update licenses to Apache
Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-07 21:35:33 -05:00
Xiang Xiao
8e06d060c2 nsh/date: Support -u option
user can use both UTC and local time now

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-02 11:10:31 +01:00
RoCorbera
42f4565129 nsh kill cmd can be executed with no signal option.
SIGTERM is the default signal, as in unix kill command.
nsh> kill [-<signal>] <pid>
2021-06-01 15:57:13 -03:00
Xiang Xiao
98de0d6a68 nsh: Add debug.h inclusion in nsh_command.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-24 16:05:07 +09:00
Xiang Xiao
1ee948e0c8 Include assert.h for DEBUGASSERT caller
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-24 12:34:37 +09:00
chao.an
8721bc6847 nshlib: Fix the build break in nsh_telnetd.c when CONFIG_NSH_CONSOLE=n
set the config:
CONFIG_NSH_ROMFSETC=y
CONFIG_NSH_CONSOLE=n

nsh_telnetd.c: In function 'nsh_telnetstart':
nsh_telnetd.c:267:22: error: 'vtbl' undeclared (first use in this function)
  267 |       nsh_initscript(vtbl);
      |                      ^~~~

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-05-07 10:53:25 -07:00
chao.an
a5337af484 nsh/telnetd: bringup the network before telnetd init
bringup the network before telnetd init if without NSH_CONSOLE

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-05-06 19:14:47 -07:00
Anthony Merlino
267aba6467 addroute: inet_pton cannot accept slash notation. We must fixup the argument before calling. 2021-04-23 03:27:40 -05:00
Sungwoo Kim
6f4b133998 nshlib: Disable mb, mh, and mw by default
- Fix https://github.com/apache/incubator-nuttx/issues/3011

Co-authored-by: Gisu Yeo <wcharcode@gmail.com>
Co-authored-by: Taegyu Kim <tgkim@purdue.edu>
2021-04-03 09:40:18 -05:00
chao.an
960e63402e nsh/builtin: Ignore the child status if run the application on background.
N/A

fix the leak of child status if the background process
exceeds "CONFIG_PREALLOC_CHILDSTATUS".

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-21 02:18:09 -07:00
Jiuzhu Dong
4c6ded2661 app: delete NFILE_DESCRIPTORS limits
Change-Id: I3ced2b2b7440a2c79a712cfc97b4cd15d2bddd4c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-12 21:12:07 -08:00
ligd
89e6fb9a42 apps/md5: fix md5 result error
MIRTOS-325

Change-Id: I0dd6c3e155b8fe41fe8ea6859271168a0d283829
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-03-03 22:12:24 -08:00
Gustavo Henrique Nihei
5cddb39b4e nshlib: Fix dependency on FSUTILS_MKFATFS 2021-02-16 04:04:59 -08:00
Alan C. Assis
382638c8c6 Add support in printf command to send 8-32 bits value 2021-01-28 05:15:59 -08:00
Xiang Xiao
28362eb6d1 nshlib: Remove fdopen for the stdin, stdout and stderr
not really need since these file stream should be opened automatically

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-16 07:53:38 +09:00
Masayuki Ishikawa
0c3ee06fb3 nshlib: Fix nsh_usbconsole.c
Summary:
- stdin/stdout/stderr are now preallocated in libc and fs_fd
  in file_struct are also initialized to -1
- So we need to call fdopen() for stdin again as we did before.
- Also, cn_outstream and cn_errstream are not needed to be set.
- See apps/nshlib/nsh_console.h as well

Impact:
- nsh_usbconsole.c only

Testing:
- Tested with stm32f4discovery:usbnsh

Signed-off-by: SUZUKI Keiji <zuki.ebetsu@gmail.com>
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-12-14 04:23:26 -06:00
chao.an
fe915679b1 style/Document: remove unnecessary trailing whitespace
N/A

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-28 12:20:10 +01:00
YAMAMOTO Takashi
d6b67eb05e nshlib/nsh_dbgcmds.c: Fix a few printf warnings 2020-11-09 04:10:59 -08:00
Subhra Sankha Sarkar
3b884cfb87 Fixing coding style issues for rest of nshlib directory - except for the false +ve nsh_timcmds.c 2020-11-02 13:30:18 +01:00
Masayuki Ishikawa
305bd0e448 nshlib: Fix nsh_configstdio() in nsh_usbconsole.c
Summary:
- This commit fixes nsh_configstdio() to setup stdout and stderr

Impact:
- Affect nsh_usbconsole only

Testing:
- Tested with stm32f4discovery:usbnsh

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-10-29 20:43:59 +09:00
Xiang Xiao
e76ab9c868 Remove all fclose with stdin, stdout and stderr
since it is wrong to close the builtin stream and specially note
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fclose.html:

Since after the call to fclose() any use of stream results in
undefined behavior, fclose() should not be used on stdin, stdout,
or stderr except immediately before process termination (see XBD
Process Termination), so as to avoid triggering undefined behavior
in other standard interfaces that rely on these streams. If there
are any atexit() handlers registered by the application, such a
call to fclose() should not occur until the last handler is
finishing. Once fclose() has been used to close stdin, stdout, or
stderr, there is no standard way to reopen any of these streams.

and it is also unnecessary because the stream always get flushed.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-29 20:43:59 +09:00
Subhra Sankha Sarkar
36b1be0609 Fixed coding std issues 2020-10-29 04:20:17 -07:00
Subhra Sankha Sarkar
76e58d9e55 Fixed coding std violations in nsh_fsutils.h 2020-10-28 06:43:43 -07:00
Subhra Sankha Sarkar
0d74608b2c Fixed build issues 2020-10-28 05:57:47 -07:00
Subhra Sankha Sarkar
23ec80fa30 Addressed review comments from @v01d and @xiaoxiang781216 2020-10-28 05:57:47 -07:00
YAMAMOTO Takashi
aa0aa73250 nsh_netcmds.c: Adapt to the new webclient api
As a bonus, check and report errors from write().

tested as: "nsh> wget http://example.com/"
2020-10-01 15:32:25 +08:00
Xiang Xiao
ecae66fe59 Replace all CONFIG_NFILE_STREAMS with CONFIG_FILE_STREAM
follow up the kernel side change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic27ad65d7cc2ea570921e0c17098dcb6bfe1893a
2020-09-11 17:57:58 +08:00
spiriou
06c7f06b1d nshlib: remove NSH_HAVE_WRITABLE_MOUNTPOINT to enable mkrd again 2020-08-23 11:38:08 -07:00
Xiang Xiao
9d80399bd5 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
2020-08-19 14:32:53 -07:00
Xiang Xiao
74c506b4d1 nsh: Don't check CONFIG_NFILE_STREAMS for mkdir/rename/rmdir/fs_unlink
since these function don't depend on standard input/output function

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I320659eff933d49c4872e43320fa30696d8b8a54
2020-08-17 00:16:21 +01:00
Masayuki Ishikawa
7f48576218 nshlib: Fix memory corruption in nsh_parse.c
Summary:
- Fix memory corruption when pthread_create() failed in nsh_execute()

Impact:

- nsh builtin command execution in background with errors

Testing:

- Tested with hifive1-revb:nsh
- Set CONFIG_MAX_TASKS=4
- Run 'sleep 1000 &' in 3 times will cause pthread_create error
- Run free, ps command

Reported-by: Yoshinori Sugino <ysgn0101@gmail.com>
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-08-11 13:57:02 +02:00
Maciej Wójcik
21049ece6e Rewritten READMEs to Markdown 2020-07-25 01:01:51 -07:00
Maciej Wójcik
51e6645f71 Rename README and README.txt to README.md 2020-07-25 01:01:51 -07:00
Xiang Xiao
942f32e22a Fix nxsytle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I36099dc6c07c7ada2f9fcb06fe0267b8d213a61a
2020-07-12 13:56:00 +01:00
Xiang Xiao
deaa6c5b7b build: Replace $(TOPDIR)/Make.defs with $(APPDIR)/Make.defs
and move NUTTXLIB defintion to the common place

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-09 15:17:37 -03:00
Xiang Xiao
95d7e9b191 nshlib: Call symlink if user pass -s for ln command
since NuttX kernel support really support symlink not link.
Note: link equal symlink now because the hard link doesn't support yet

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I47437f5fd8bbab3a5539d0eb6f690f633b422345
2020-07-01 11:59:00 +02:00
Gregory Nutt
192273da2e Revert "nshlib: remove the dependency of date on RTC"
This is a bad change.  It has been show to cause an increase in size by around 2.3Kb in minimal configurations that cannot tolerate that massive size increase.

This reverts commit 4adb83c754.
2020-06-24 16:07:55 -07:00
Xiang Xiao
69f013e74e build: Remve the unnecessary .gitignore
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-23 15:56:35 +01:00
Xiang Xiao
ead498a788 build: Remove the workaround for the inexistence of .config/Make.defs
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-21 17:43:42 +01:00
Masayuki Ishikawa
bd47c468c5 nshlib: Introduce CONFIG_NSH_WGET_BUFF_SIZE
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-05-18 20:00:28 -06:00
chao.an
898c1ce4d2 Revert "This critical behavior was broken by this commit:"
This reverts commit 9b06b508f9.

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-18 06:53:57 -06:00
Gregory Nutt
4f54a75c48 apps/nshlib/nsh_parse.c: Add some comments.
Add some comments to nsh_parse.c emphasizing the reason that things are done in the order that they are.  Perhaps such comments will avoid similar breakage in the future.
2020-05-18 10:03:17 +08:00