Commit Graph

863 Commits

Author SHA1 Message Date
Xiang Xiao
aac20c317c Fix compiler warning
chrono_main.c: In function 'chrono_main':
Error: chrono_main.c:396:11: error: 'strncpy' output truncated before terminating nul copying 7 bytes from a string of the same length [-Werror=stringop-truncation]
  396 |           strncpy(str, "00:00.0", 7);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~
Error: chrono_main.c:434:25: error: '%02ld' directive writing between 2 and 9 bytes into a region of size 8 [-Werror=format-overflow=]
  434 |           sprintf(str, "%02ld:%02ld:%01ld", min, sec,
      |                         ^~~~~
chrono_main.c:434:24: note: directive argument in the range [-35791394, 35791394]
  434 |           sprintf(str, "%02ld:%02ld:%01ld", min, sec,
      |                        ^~~~~~~~~~~~~~~~~~~
chrono_main.c:434:24: note: directive argument in the range [-59, 59]
chrono_main.c:434:24: note: directive argument in the range [-21, 21]
chrono_main.c:434:11: note: 'sprintf' output between 8 and 18 bytes into a destination of size 8
  434 |           sprintf(str, "%02ld:%02ld:%01ld", min, sec,
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  435 |                   (priv->ts_end.tv_nsec / 100000000));
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

nsh_routecmds.c: In function 'cmd_delroute':
Error: nsh_routecmds.c:611:11: error: 'memset' forming offset [16, 27] is out of the bounds [0, 16] of object 'inaddr' with type 'union <anonymous>' [-Werror=array-bounds]
  611 |           memset(&inaddr.ipv6, 0, sizeof(struct sockaddr_in6));
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nsh_routecmds.c:491:5: note: 'inaddr' declared here
  491 |   } inaddr;
      |     ^~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-07 13:34:28 +02:00
Xiang Xiao
d4290b3e93 Fix error: 'memset' forming offset [16, 27] is out of the bounds [0, 16] of object 'inaddr' with type 'union <anonymous>'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-05 17:02:43 +01:00
Xiang Xiao
82b94fc76f Simplify DEFAULT_SMALL usage in Kconfig
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-01 22:46:47 +08:00
anjiahao
4680a25a8c cmd_dd:if read nbyte less than bs,must write nbyte
if a file size is 10
use dd if=a of=b bs = 8
b file size will 16, is a error
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-02-24 10:21:33 -03:00
Jiuzhu Dong
283b1a4dfc nshlib/cmd_memdump: support new command: memdump
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-02-24 02:16:00 +08:00
Jiuzhu Dong
372621ed06 nshlib/ps: support display heap info for every task by cmd ps
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-02-24 02:16:00 +08:00
Xiang Xiao
0b722cc864 nshlib: Remove format variable from date_showtime
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-23 01:21:44 +08:00
Xiang Xiao
4cc0c755bf Remove CONFIG_CLOCK_MONOTONIC special code
since this opion doesn't exist anymore

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-23 01:21:44 +08:00
Xiang Xiao
f6f4bbff3a Replace EXIT_SUCCESS with 0 for BOARDIOC_[POWEROFF|RESET]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-29 12:44:41 +01:00
Fotis Panagiotopoulos
6daec61423 Typo fix. 2022-01-28 00:02:08 +08:00
Norman Rasmussen
374cb9230a Fix boarctl typos 2022-01-16 08:07:47 +01:00
Fotis Panagiotopoulos
bc5d8034f1 Typo fixes. 2022-01-06 10:30:41 +08:00
Norman Rasmussen
6285990a5c Remove trailing whitespace from commands as parameters 2022-01-01 22:18:07 +08:00
Norman Rasmussen
92287e2b14 Fix some edge case bugs in nsh_parse
- Handle nsh_filecat returning NULL on failure
- Background and redirect must be restored after an empty line
- Output redirection should be removed from argv like background
2022-01-01 22:18:07 +08:00
Norman Rasmussen
41ce7d40f6 Fix incorrect argument count error message
The `too many arguments` and `missing required argument(s)` messages
should be switched in order for the correct message to be shown to the
user.
2021-12-31 20:54:05 +08:00
Xiang Xiao
66dbaa4539 Replace self defined macros with NET_SOCK_[FAMILY|TYPE|PROTOCOL]
NET_SOCK_* is defined by nuttx/net/netconfig.h and then can be shared

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-20 16:04:29 -03:00
ligd
a4dd508c9c nshlib/nsh_proccmds.c: update ps_callback when get Group
Cause of "Group:" always have in file "status"

Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-11-11 11:13:04 -03:00
Xiang Xiao
850c036c58 nshlib/stdsession: Handle the command arguments in any order
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-09 13:39:10 -03:00
Xiang Xiao
ad09ca2a80 nshlib: sync nsh_stdsession.c with nsh_session.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-09 13:39:10 -03:00
Xiang Xiao
a0f773b318 nshlib/nsh_session: Handle the command arguments in any order
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-09 09:35:40 -03:00
Xiang Xiao
991e491c94 nsh: Remove the duplicated NSH_MMCSDMINOR
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-08 10:43:47 -03:00
Xiang Xiao
35e442d08c system/readline: Move READLINE_HAVE_EXTMATCH inside SYSTEM_READLINE section
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-08 10:43:47 -03:00
Xiang Xiao
8b447704d3 nshlib: Disable Individual commands when DEFAULT_SMALL equals y
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-07 13:17:52 +01:00
anjiahao
80dcc185f3 echo: support echo opthon -e
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2021-10-21 23:33:09 -05:00
Jiuzhu Dong
5a5448df04 nsh: fix compile break about closing CONFIG_NSH_DISABLESCRIPT
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-09-12 11:37:19 +08:00
Jiuzhu Dong
16c9068d5f nsh: fix compile break about closing CONFIG_NSH_DISABLEBG
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-09-12 11:36:54 +08:00
Juha Niskanen
b283289986 apps: fix miscellaneous typos
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-08-26 11:39:28 -07:00
SPRESENSE
8e0892b2f2 nshlib: Fix write buffer position in nsh cp command
The iobuffer for write buffer position need to be update if write
API cannot write data at once.
2021-08-19 08:31:34 -07:00
Xiang Xiao
d4d2f13f89 Rename CONFIG_LIB_BOARDCTL to CONFIG_BOARDCTL
since boardctl isn't a libc feature

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-06 11:04:35 +02:00
Xiang Xiao
967f526850 Rename LIB_ to LIBC_ for all libc Kconfig
follow other libc component naming convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-05 16:42:32 +02:00
Jiuzhu Dong
32e7a7fde0 nshlib: support c++ access nsh api
N/A

Change-Id: I90de4a4ce1f089a2db2e3b81f83f7b39434d6421
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-12 04:43:36 -07:00
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