Commit Graph

967 Commits

Author SHA1 Message Date
Gustavo Henrique Nihei
b61686b866 nshlib: Include missing "sched.h" header
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-03-06 18:52:31 +02:00
Huang Qi
12d31075eb nsh: Fix a buffer overflow in help
Introduced by https://github.com/apache/nuttx-apps/pull/1610,
internal line buffer should have more bytes for tab before newline and '\0'.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-05 11:18:59 +02:00
Huang Qi
9bb730fb6b nsh: Don't echo password during login
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-04 01:44:40 +08:00
Huang Qi
2e49d78400 nsh/login: FIx error prompt length
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-04 01:44:40 +08:00
Huang Qi
f1ba1a40ed nsh: Improve performance of ps by merge nsh_output
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-03 17:41:39 +09:00
Huang Qi
e957e1633c nsh: Improve performance of help by line buffer
This change reduce the usage of `printf`,
which will improve both CPU usage and IO performance.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-03 17:41:39 +09:00
yinshengkai
fa589ae622 nsh: fix nsh startup failure
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-01 21:26:01 +08:00
Xiang Xiao
a4f7129984 Fix nsh_builtin.c:91:22: error: 'SA_NOCLDWAIT' undeclared
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-26 19:02:28 +02:00
Xiang Xiao
359f66ad37 nshlib: Remove the remaining CONFIG_FILE_STREAM dependence
continue the change from https://github.com/apache/nuttx-apps/pull/1559

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-24 17:38:19 +08:00
Xiang Xiao
80feb2432d nshlib: Shouldn't set TIOCSCTTY with STDOUT_FILENO directly
to handle the shell redirection correctly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-24 17:38:19 +08:00
lilei19
41f60bd669 change strcpy to strlcpy
Change-Id: I8b9429a3c225a82842fce136bdb14b8b135066d3
Signed-off-by: lilei19 <lilei19@xiaomi.com>
2023-02-22 23:09:55 +08:00
Huang Qi
95f32fd018 nsh: Decouple with CONFIG_FILE_STREAM
Replace all fwrite/fread/fgets/... to write/read/...

Before:
```
       text    data     bss     dec     hex filename
 109827     601    6608  117036   1c92c nuttx/nuttx
```
    After:
```
       text    data     bss     dec     hex filename
108053     601    6608  115262   1c23e nuttx/nuttx
```
    After with CONFIG_FILE_STREAM disabled:
```
       text    data     bss     dec     hex filename
 105667     601    6608  112876   1b8ec nuttx/nuttx
```

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-02-22 13:47:41 +08:00
Oreh
f63a3cac0e Add NSH lomtd command (creates MTD loop device) 2023-02-19 19:55:52 +08:00
Nathan Hartman
8e77b79f78 Kconfig: Make indent consistent with TABS 2023-02-10 14:11:48 +08:00
Xiang Xiao
a29d9ea9da fsutils/examples: Include unistd.h explicitly
to get the prototypes or macros are defined in it

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-05 08:46:59 +02:00
Gustavo Henrique Nihei
b0da60e498 apps: Use MIN/MAX definitions from "sys/param.h"
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-02 00:35:14 +02:00
Zhe Weng
93b4dc2692 ifconfig: Support ifconfig interface and update arg limit
From comment in cmd_ifconfig, it seems that we support `ifconfig [interface]`, but actually not considering the interface param now. After this commit, we only print the information of interface specified in param, just like linux.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-02-01 11:12:24 +08:00
Fotis Panagiotopoulos
464607dc90 Fixed compiler warnings in dd. 2023-01-30 10:59:07 +08:00
Alan Carvalho de Assis
4ed5bec472 Enable TMPFS and NSH_QUOTE to get CONFIG_NSH_CMDPARMS working 2023-01-24 13:24:23 +01:00
dongjiuzhu1
542558f2c1 nshlib/script: avoid output unnecessary log when missing rc.sysinit file
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-12-31 00:40:00 +08:00
Zhe Weng
2ad05e3062 ifconfig: Support prefixlen/CIDR for IPv6
Linux:
ifconfig eth0 [inet6] add 2022::2/96

FreeBSD:
ifconfig eth0 inet6 2022::2/96
ifconfig eth0 inet6 2022::2 prefixlen 96

NuttX newly supported:
ifconfig eth0 inet6 [add] 2022::2/96
ifconfig eth0 inet6 [add] 2022::2 prefixlen 96

Ref:
https://man7.org/linux/man-pages/man8/ifconfig.8.html
https://www.freebsd.org/cgi/man.cgi?ifconfig

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2022-12-29 17:33:59 +08:00
Zhe Weng
8f10dde6ad ifconfig: Allow hostip on first non-option place after inet/inet6
NuttX previous:

ifconfig eth0 10.0.0.1 [inet]
ifconfig eth0 2022::2 inet6

Try to be compatible with other systems:

Linux:
ifconfig eth0 [inet] 10.0.0.1
ifconfig eth0 [inet6] add 2022::2

FreeBSD:
ifconfig eth0 inet 10.0.0.1
ifconfig eth0 inet6 2022::2

NuttX newly supported:
ifconfig eth0 [inet] 10.0.0.1
ifconfig eth0 inet6 [add] 2022::2

Ref:
https://man7.org/linux/man-pages/man8/ifconfig.8.html
https://www.freebsd.org/cgi/man.cgi?ifconfig

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2022-12-29 17:33:59 +08:00
Xiang Xiao
d1e46c2d3e compiler.h: Add _ between format|printf|syslog|scanf|strftime and like
align with other macro naming style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-21 01:05:12 +02:00
huangjian
78020aec0d nshlib:nsh login include nshlib/nshlib.h
Signed-off-by: huangjian <huangjian@xiaomi.com>
2022-12-20 23:39:36 +08:00
Xiang Xiao
cfc005a460 arp: Remove the unnecessary inclusion of nuttx/net/arp
and change the remain inclusion to netinet/arp.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-16 22:11:10 +02:00
Xiang Xiao
9884159346 nshlib: Add login skip, invalid name ignore and password challenge to telnet login
forget in the follow patches:
commit 6aef469c19
Author: huangjian <huangjian@xiaomi.com>
Date:   Fri Nov 4 20:37:04 2022 +0800

    nshlib:judge whether nsh login username is a valid input

    Signed-off-by: huangjian <huangjian@xiaomi.com>

commit 88fff23d34
Author: huangjian <huangjian@xiaomi.com>
Date:   Fri Nov 4 20:39:26 2022 +0800

    nshlib:add platform skip login function

    Signed-off-by: huangjian <huangjian@xiaomi.com>

commit 5a623cc9e3
Author: huangjian <huangjian@xiaomi.com>
Date:   Fri Nov 4 20:35:07 2022 +0800

    nshlib:add platform challenge function for nsh login

    Signed-off-by: huangjian <huangjian@xiaomi.com>

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-16 16:31:05 +02:00
zhanghongyu
c7e8ade590 arp: change arptable get struct from arp_entry_s to arpreq
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-12-14 21:19:37 +08:00
zhanghongyu
df3121213e cmd_arp: add device input for arp interface
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-12-14 21:19:37 +08:00
huangjian
6aef469c19 nshlib:judge whether nsh login username is a valid input
Signed-off-by: huangjian <huangjian@xiaomi.com>
2022-12-04 19:24:57 +08:00
huangjian
88fff23d34 nshlib:add platform skip login function
Signed-off-by: huangjian <huangjian@xiaomi.com>
2022-12-04 19:24:57 +08:00
huangjian
5a623cc9e3 nshlib:add platform challenge function for nsh login
Signed-off-by: huangjian <huangjian@xiaomi.com>
2022-12-04 19:24:57 +08:00
anjiahao
14465b85c4 cmd_dd:support dd can do verify
After writing the file, compare the contents of the two files again

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-11-14 20:40:43 +08:00
anjiahao
c2f07a4d5a dd:simplified cmd_dd code steps
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-11-14 20:40:43 +08:00
Xiang Xiao
36a0c924f7 netutils: Support telnetd in the kernel mode
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-07 15:24:08 +09:00
Xiang Xiao
12863fbd52 system/telnet: Fix the style warning
and remove the unused code

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-07 15:24:08 +09:00
Xiang Xiao
678415c6fa Rename task_spawnattr_setstacksize to posix_spawnattr_setstacksize
follow up the kernel side change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-01 09:51:08 +09:00
Xiang Xiao
757552e759 Fix nsh_fscmds.c:92:19: error: unused function 'ls_specialdir' [-Werror,-Wunused-function]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-31 06:28:17 +01:00
Petro Karashchenko
ec1c5f9273 Revert "Revert "nshlib: fix possible out of bounds array access""
This reverts commit fe4b44e3ff.
2022-10-24 01:13:27 +08:00
Petro Karashchenko
fe4b44e3ff Revert "nshlib: fix possible out of bounds array access"
This reverts commit f6a86a578d.
2022-10-23 08:29:01 +02:00
Petro Karashchenko
f6a86a578d nshlib: fix possible out of bounds array access
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-10-23 11:45:52 +08:00
Xiang Xiao
0d2ef47192 nshlib: Rename CONFIG_SYSTEM_NSH_SYMTAB to CONFIG_NSH_SYMTAB
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 22:18:38 +02:00
Xiang Xiao
b659f0fbdf Remove the unnecessary cast for main_t, NULL and argv
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 18:40:23 +02:00
Xiang Xiao
6944c5a0a1 nshlib: Fix warning reported by clang
nsh_telnetlogin.c:62:15: error: implicit conversion from 'int' to 'char' changes value from 255 to -1 [-Werror,-Wconstant-conversion]

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:14:20 +02:00
Xiang Xiao
75455d3788 nshlib: Reuse nsh_session logic in nsh_telnetmain
to avoid the code duplication

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 09:41:43 -03:00
Xiang Xiao
8e460e7e19 nshlib: Move symbol table initialization from nsh_main to nsh_initialize
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 15:39:10 -04:00
Xiang Xiao
0d210c3227 nshlib: Move commoin initialization from console_main to nsh_initialize
to avoid the code duplication

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 15:39:10 -04:00
Xiang Xiao
964747dd36 nshlib: Call nsh_telnetstart in nsh_initialize to avoid the dupliation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 15:39:10 -04:00
Xiang Xiao
cf70d8f95b nshlib: Call nsh_sysinitscript in usb or alt console like normal one
forget in the pull request:
https://github.com/apache/incubator-nuttx-apps/pull/1142

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 15:39:10 -04:00
Xiang Xiao
893387b2c5 Fix the minor style issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 19:07:16 +02:00
Xiang Xiao
4941182cc6 Make.defs: Change "ifeq ($(XXX),y)" to "ifneq ($(XXX),)
to support the tristate option correctly and unify the usage

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 14:59:08 +02:00