Xiang Xiao
fe7f217497
nshlib: losetup/lomtd change "-s <sectsize>" to "-b <sectsize>"
...
to follow host tool usage:
https://github.com/util-linux/util-linux/blob/master/sys-utils/losetup.c#L473
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-16 13:14:48 -04:00
Xiang Xiao
9e31a26edc
Fix nsh_altconsole.c:152:41: error: implicit declaration of function 'strlen'
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-26 00:31:09 +08:00
Ville Juven
e9f4e87786
nsh_alias.c: unalias -a command does not work correctly
...
getopt returns the argument if it is found, so testing against != ERROR is
wrong.
2023-09-25 21:05:37 +08:00
dulibo1
049aaa4c96
pmconfig: check domain if invaild return error avoid to crash
...
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-09-22 09:16:54 +08:00
0528Mike
a46a661b34
Update nshlib/nsh_codeccmd.c
...
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-21 10:48:29 +08:00
wangmingrong
2459476b65
nshlib: Implementation of modifying command md5
...
Simplify the "cmd_codecs_proc" md5 related framework and modify the implementation of the command md5:
Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2023-09-21 10:48:29 +08:00
Daniel Appiagyei
b37e84b05f
c++ compatibility: rename usages of reserved c++ keywords 'this' and 'public'
2023-09-16 19:45:52 +08:00
wangmingrong
5e59b0b384
nshlib: Fix static scanning errors
...
Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2023-09-08 18:49:31 +08:00
Xiang Xiao
6aa05b5855
Replace strlen with sizeof for kconfig string
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-02 16:26:51 +03:00
anjiahao
8d7497f7fb
memdump:fix bug with space does not parse correctly
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-08-29 23:14:06 +08:00
Niklas Hauser
78a6d07a90
nshlib/nsh_consolemain: detect null pointer
...
Returning with an error from nsh_consolemain prevents dereferencing a
NULL pointer later in the code.
2023-08-29 03:11:28 +08:00
wangmingrong
7981278021
apps/nshlib: Add the pidof command and API nsh_getpid
...
Add the API "nsh_getpid" in "nsh_fsutils. c" and the nsh command pidof. Temporarily support two parameters, - s, and process name
Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2023-08-29 02:58:45 +08:00
wanggang26
75c8580238
nshlib: fix a typo
...
painc to panic
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2023-08-28 17:33:15 +03:00
Ville Juven
94d477b3df
nshlib/nsh_console.h: Add nsh_none, where any empty output can be forwarded
...
Add nsh_none to consume all empty traces from nsh.
For the variadic argument case need to add a (inline) function to eat
away the __VA_ARGS__ list, there is no good / portable way to do this by
pre-processor macros, but a function will eat the variadic list whatever
its size is.
2023-08-25 17:18:35 +08:00
Ville Juven
1668c3e97d
Revert "nshlib/nsh_timcmds.c: Suppress warning about unused variable (errfmt)"
...
This reverts commit 4ca9b518fa9923c1af9c120eafbac59359874e13.
2023-08-25 17:18:35 +08:00
Ville Juven
b65b577ad3
nshlib/nsh_timcmds.c: Suppress warning about unused variable (errfmt)
...
Fixes following warning:
CC: grp/lib_getgrbufr.c nsh_timcmds.c: In function 'cmd_date':
nsh_timcmds.c:370:19: warning: variable 'errfmt' set but not used [-Wunused-but-set-variable]
370 | FAR const char *errfmt;
|
2023-08-23 00:17:25 +08:00
raiden00pl
2b58cc6578
rptun/ping: fix invalid use of nsh_error after 31421db6f
2023-08-21 18:47:01 +03:00
raiden00pl
31421db6fa
rptun/ping: print invalid arguments error
2023-08-20 22:58:07 +08:00
Xiang Xiao
b586ab839d
nshlib: Don't select LIBC_NETDB automatically
...
since nshlib always call netdb API inside #ifdef CONFIG_LIBC_NETDB
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-08-12 15:58:11 +03:00
anjiahao
79e481d093
resetcause:show reset string not number
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-08-10 13:51:43 +08:00
yinshengkai
105fd2aac5
nsh: fix a buffer overflow in help
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-09 18:22:09 +08:00
fangxinyong
2234c3a2e6
nshlib: support list numeric user and group IDs
...
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-09 15:06:09 +08:00
Zhe Weng
396ab2e931
nsh/alias: Fix compiler warning
...
Got use-after-free warning under GCC 12 with `-O3` option, and I found
that `nsh_strcat` may realloc `ptr`, then `cmdline` may point to invalid
memory.
Let `cmdline` point to the reallocated `ptr` may solve the problem.
Tested by `alias ll='ls -l'` and `ll /` on sim.
GCC output:
CC: binfmt_unloadmodule.c In function 'nsh_aliasexpand',
inlined from 'nsh_argument' at nsh_parse.c:1879:20:
nsh_parse.c:1196:23: error: pointer 'ptr' used after 'realloc' [-Werror=use-after-free]
1196 | ptr = cmdline + len;
| ~~~~~~~~^~~~~~~~~~~~~~~
In function 'nsh_strcat',
inlined from 'nsh_aliasexpand' at nsh_parse.c:1190:21,
inlined from 'nsh_argument' at nsh_parse.c:1879:20:
nsh_parse.c:1100:27: note: call to 'realloc' here
1100 | argument = (FAR char *)realloc(s1, allocsize);
| ^~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-01 08:13:23 -07:00
wanggang26
cb684097b8
nshlib: add print negative number support for echo command
...
Fix issue that "echo -1" will give "argument invalid" error
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2023-07-31 07:58:41 -07:00
wanggang26
f585d74b8c
nshlib: refine dd verify printing format
...
before:
infile sector 0
7f454c46010101000000000000000000
02002800010000007d13001834000000
8cbd2a00000400053400200004002800
now:
infile sector 0:
0000: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 .ELF............
0010: 02 00 28 00 01 00 00 00 7d 13 00 18 34 00 00 00 ..(.....}...4...
0020: 8c bd 2a 00 00 04 00 05 34 00 20 00 04 00 28 00 ..*.....4. ...(.
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2023-07-30 22:21:34 -07:00
wanggang26
9621aca73c
nshlib: add negative number logical judgement support for test and [ command
...
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2023-07-30 22:20:02 -07:00
wangjianyu3
fc8c425cc0
Fix dependents of nsh_foreach_direntry
...
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2023-07-28 21:51:50 -07:00
Xiang Xiao
8083b094c3
Kconfig: Simplify the conditional default statement
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-25 09:51:09 +08:00
chenrun1
046fe00b96
nsh_fscmd.c:fix "implicit declaration" warning.
...
Fix error: implicit declaration of function 'nsh_foreach_direntry' [-Werror=implicit-function-declaration] on file nsh_fscmds on some compiler versions.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2023-07-16 16:39:11 +08:00
chenrun1
415168dde6
nshlib: Add fdinfo to get information about the process associated fd
...
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2023-07-16 16:39:11 +08:00
Xiang Xiao
dab972b907
Remove the const cast from the initialization of boardioc_symtab_s::symtab
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-08 16:01:52 +03:00
chao an
4d79a5cbaf
add initial cmake build system
...
Co-authored-by: Daniel Agar <daniel@agar.ca>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:52:02 +08:00
Junbo Zheng
9de5a2550e
nshlib: add -h
option for ls command
...
config: ./tools/configure.sh sim:nsh
CONFIG_LIBC_FLOATINGPOINT=y
```
nsh> ls -l /dev
/dev:
crw-rw-rw- 0 console
crw-rw-rw- 0 gpio0
crw-rw-rw- 0 gpio1
crw-rw-rw- 0 gpio2
crw-rw-rw- 0 gpio3
crw-rw-rw- 0 loop
crw-rw-rw- 0 null
crw-rw-rw- 0 oneshot
brw-rw-rw- 1048576 ram0
brw-rw-rw- 1024 ram1
brw-rw-rw- 524288 ram2
crw-rw-rw- 0 zero
nsh> ls /lh /dev
nsh: ls: too many arguments
nsh> ls -lh /dev
/dev:
crw-rw-rw- 0 console
crw-rw-rw- 0 gpio0
crw-rw-rw- 0 gpio1
crw-rw-rw- 0 gpio2
crw-rw-rw- 0 gpio3
crw-rw-rw- 0 loop
crw-rw-rw- 0 null
crw-rw-rw- 0 oneshot
brw-rw-rw- 1.0M ram0
brw-rw-rw- 1.0K ram1
brw-rw-rw- 512.0K ram2
crw-rw-rw- 0 zero
```
config: ./tools/configure.sh ../vendor/sim/boards/miwear/configs/miwear -j16
```
nsh> ls -l /resource/misc/media
/resource/misc/media:
-rwxrwxr-x 384044 AlexaTimer.wav
-rwxrwxr-x 57001 AlexaReminder.mp3
-rwxrwxr-x 384132 AlexaAlarm.wav
-rw-rw-r-- 20733 Clank.mp3
-rw-rw-r-- 45183 NotificationXylophone.mp3
-rw-rw-r-- 27420 Robot.mp3
-rw-rw-r-- 21986 FadeIn.mp3
-rw-rw-r-- 42049 Flute.mp3
-rw-rw-r-- 362748 Latona-15s.mp3
drwxrwxr-x 4096 .
-rw-rw-r-- 47198 alarm_volume_adjust.mp3
-rw-rw-r-- 95338 Expect.mp3
drwxrwxr-x 4096 ..
-rw-rw-r-- 409435 Sunrise.mp3
-rw-rw-r-- 55841 Fresh.mp3
-rw-rw-r-- 36685 Bells-1s.mp3
-rw-rw-r-- 4432 camera_click.mp3
-rw-rw-r-- 469621 MiRemix.mp3
nsh>
nsh> ls -lh /resource/misc/media
/resource/misc/media:
-rwxrwxr-x 375.0K AlexaTimer.wav
-rwxrwxr-x 55.7K AlexaReminder.mp3
-rwxrwxr-x 375.1K AlexaAlarm.wav
-rw-rw-r-- 20.2K Clank.mp3
-rw-rw-r-- 44.1K NotificationXylophone.mp3
-rw-rw-r-- 26.8K Robot.mp3
-rw-rw-r-- 21.5K FadeIn.mp3
-rw-rw-r-- 41.1K Flute.mp3
-rw-rw-r-- 354.2K Latona-15s.mp3
drwxrwxr-x 4.0K .
-rw-rw-r-- 46.1K alarm_volume_adjust.mp3
-rw-rw-r-- 93.1K Expect.mp3
drwxrwxr-x 4.0K ..
-rw-rw-r-- 399.8K Sunrise.mp3
-rw-rw-r-- 54.5K Fresh.mp3
-rw-rw-r-- 35.8K Bells-1s.mp3
-rw-rw-r-- 4.3K camera_click.mp3
-rw-rw-r-- 458.6K MiRemix.mp3
```
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2023-07-05 16:25:27 +08:00
Stuart Ianna
53e837e357
nshlib/dd: Increase the integer width for sector size in dd.
...
On some systems, using sector sizes larger than 65536 is needed for
profiling performance or testing.
2023-06-26 13:56:29 +08:00
raiden00pl
400951b7de
nsh_usbconsole.c: add support for NSH console over a composite device
2023-06-15 03:23:04 +08:00
chao an
ec63217b48
nshlib: disable nsh error print if NSH_DISABLE_ERROR_PRINT enabled
...
text data bss dec hex filename
398953 27088 4128 430169 69059 nuttx /* before */
389241 27072 4128 420441 66a59 nuttx /* after */
-9712 -16
Signed-off-by: chao an <anchao@xiaomi.com>
2023-06-12 13:37:27 +08:00
Petro Karashchenko
aed0e2873e
apps: fix style issues in code
...
Add missing FAR and CODE to pointers
Remove FAR for non-pointer variables
Remove extra spaces and align the parameters
Add do {} while(0) wrapper in macro
Use nitems to calculate number of elements in arrays
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-06-11 18:47:50 +08:00
chao an
e4cf94b509
nshlib/command: exclude usage to reduce data size
...
Test on sim/nsh (CONFIG_NSH_DISABLE_HELP=y):
text data bss dec hex filename
393746 26824 4000 424570 67a7a nuttx /* before */
391858 26440 4000 422298 6719a nuttx /* after */
-1888 -384
Signed-off-by: chao an <anchao@xiaomi.com>
2023-06-10 02:20:49 +08:00
simbit18
ca4ff01cf9
nshlib/Kconfig: Fix Kconfig style
...
Remove spaces from Kconfig file
2023-05-23 02:52:17 +08:00
Xiang Xiao
e81227f99d
Indent the define statement by two spaces
...
follow the code style convention
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-22 11:57:40 +02:00
Xiang Xiao
7032c72f2f
Indent the define statement by two spaces
...
follow the code style convention
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-21 07:39:53 +03:00
anjiahao
e68d5ffb98
support memdump can dump by seq number
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-05-21 00:08:48 +08:00
Takumi Ando
baf5509b59
nshlib: Add support for disabling echoback
...
If CONFIG_NSH_DISABLE_ECHOBACK is selected,
the NSH disables echoback prompt.
Signed-off-by: Takumi Ando <t-ando@advaly.co.jp>
2023-05-18 17:22:14 +08:00
chao an
28973a37b3
nshlib: fix memory leak found out by -fanalyzer
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-16 22:43:21 -07:00
wangchen
cb292d0608
nshlib/netcmds:modify the description of setting MTU
...
modify the description of setting MTU
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2023-05-10 19:56:04 +08:00
Xiang Xiao
73701cd7cd
Replace all strncpy with strlcpy
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 21:35:16 +03:00
Xiang Xiao
7c37421266
Replace all sprintf with snprintf
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 21:35:16 +03:00
Xiang Xiao
134b8b538f
Replace all strcat with strlcat
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 21:35:16 +03:00
Xiang Xiao
bebae28bdd
nsh: Fix the typo error cmd_swtichboot -> cmd_switchboot
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-03 17:40:49 +03:00
wangchen
c2f75330f7
nshlib/netcmds:support to set MTU
...
Usage:ifconfig interfacename mtu ***
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2023-04-27 18:02:23 +08:00