nuttx-apps/nshlib
wangjianyu3 aaf4e9d480 nshlib: Support "-f" option for command "rm"
In below two cases "rm" command with "-f" option will return 0:
  a. Bad arguments
  b. File not exists

Following "rm" of GNU coreutils 8.32

GNU coreutils
  $ rm --version
  rm (GNU coreutils) 8.32
  Copyright (C) 2020 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.

  Written by Paul Rubin, David MacKenzie, Richard M. Stallman,
  and Jim Meyering.

  $ rm /FILE_NOT_EXISTS
  rm: cannot remove '/FILE_NOT_EXISTS': No such file or directory
  $ echo $?
  1

  $ rm -f
  $ echo $?
  0

  $ rm -f /FILE_NOT_EXISTS
  $ echo $?
  0

Without this patch
  nsh> rm
  nsh: rm: missing required argument(s)

  nsh> rm /FILE_NOT_EXISTS
  nsh: rm: unlink failed: 2
  nsh> echo $?
  1

With this patch
  nsh> rm -f
  nsh> echo $?
  0

  nsh> rm -f /FILE_NOT_EXISTS
  nsh> echo $?
  0

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:45:37 +08:00
..
CMakeLists.txt nshlib/prompt: extend NSH prompt string management 2024-02-25 00:55:47 -08:00
Kconfig apps/nshlib: Never disable HELP and ? 2024-04-06 13:34:56 +08:00
Make.defs Make.defs: Change "ifeq ($(XXX),y)" to "ifneq ($(XXX),) 2022-10-16 14:59:08 +02:00
Makefile nshlib/prompt: extend NSH prompt string management 2024-02-25 00:55:47 -08:00
nsh_alias.c nsh_alias.c: unalias -a command does not work correctly 2023-09-25 21:05:37 +08:00
nsh_altconsole.c feat(nsh): input (stdin) redirection 2024-08-08 19:19:18 -03:00
nsh_builtin.c feat(nsh): input (stdin) redirection 2024-08-08 19:19:18 -03:00
nsh_codeccmd.c Update nshlib/nsh_codeccmd.c 2023-09-21 10:48:29 +08:00
nsh_command.c nshlib: Support "-f" option for command "rm" 2024-09-19 03:45:37 +08:00
nsh_console.c feat(nsh): add console read 2024-08-08 19:19:18 -03:00
nsh_console.h feat(nsh): add console read 2024-08-08 19:19:18 -03:00
nsh_consolemain.c nshlib/nsh_consolemain: detect null pointer 2023-08-29 03:11:28 +08:00
nsh_dbgcmds.c nshlib: disable nsh error print if NSH_DISABLE_ERROR_PRINT enabled 2023-06-12 13:37:27 +08:00
nsh_ddcmd.c nshlib/ddcmd:Fixed NSH_CMDOPT_DD_STATS output format warning in 64-bit environment 2024-08-07 15:04:39 +08:00
nsh_envcmds.c nshlib: add print negative number support for echo command 2023-07-31 07:58:41 -07:00
nsh_fileapps.c nsh_fileapp: handle input redirection 2024-08-08 19:19:18 -03:00
nsh_fscmds.c nshlib: Support "-f" option for command "rm" 2024-09-19 03:45:37 +08:00
nsh_fsutils.c nshlib: Fix static scanning errors 2023-09-08 18:49:31 +08:00
nsh_init.c nshlib/prompt: extend NSH prompt string management 2024-02-25 00:55:47 -08:00
nsh_login.c Replace all strncpy with strlcpy 2023-05-08 21:35:16 +03:00
nsh_mmcmds.c nsh_mmcmds: support "memdump -h/help" to show usage and sequence number 2024-01-06 04:34:27 -08:00
nsh_mntcmds.c apps/nshlib: add the missing FAR macro for all source files 2022-09-22 14:22:13 +08:00
nsh_modcmds.c nshlib: Remove the remaining CONFIG_FILE_STREAM dependence 2023-02-24 17:38:19 +08:00
nsh_netcmds.c netutils/netlib: Encapsulate the dhcp configuration network code and modify at all calling locations 2024-08-23 22:10:04 +08:00
nsh_parse.c greenhills: fix the variable unused warning 2024-08-20 02:50:13 +08:00
nsh_passwdcmds.c apps/nshlib: add the missing FAR macro for all source files 2022-09-22 14:22:13 +08:00
nsh_printf.c nshlib: Remove the remaining CONFIG_FILE_STREAM dependence 2023-02-24 17:38:19 +08:00
nsh_proccmds.c apps/nshlib: Add the pidof command and API nsh_getpid 2023-08-29 02:58:45 +08:00
nsh_prompt.c nshlib/prompt: extend NSH prompt string management 2024-02-25 00:55:47 -08:00
nsh_routecmds.c netlib/setroute: fix dhcpd stack-overflow when calls netlib_set_dripv4addr with debug info-level 2024-08-26 01:54:46 +08:00
nsh_script.c nshlib: move g_builtin_prompt from data to rodata 2024-09-05 09:49:44 +08:00
nsh_session.c nshlib/prompt: extend NSH prompt string management 2024-02-25 00:55:47 -08:00
nsh_syscmds.c add include to handle when PM_NDOMAINS from pm.h 2024-05-18 22:08:14 +08:00
nsh_system.c nshlib: Remove the remaining CONFIG_FILE_STREAM dependence 2023-02-24 17:38:19 +08:00
nsh_telnetd.c netutils: Support telnetd in the kernel mode 2022-11-07 15:24:08 +09:00
nsh_telnetlogin.c Replace all strncpy with strlcpy 2023-05-08 21:35:16 +03:00
nsh_test.c nshlib: add negative number logical judgement support for test and [ command 2023-07-30 22:20:02 -07:00
nsh_timcmds.c feat(nsh): input (stdin) redirection 2024-08-08 19:19:18 -03:00
nsh_usbconsole.c nsh_usbconsole.c: add support for NSH console over a composite device 2023-06-15 03:23:04 +08:00
nsh_usbtrace.c nshlib: Remove the remaining CONFIG_FILE_STREAM dependence 2023-02-24 17:38:19 +08:00
nsh_vars.c Replace all sprintf with snprintf 2023-05-08 21:35:16 +03:00
nsh.h nsh_fileapp: handle input redirection 2024-08-08 19:19:18 -03:00
rc.sysinit.template nsh/script: support rc.sysinit script 2022-04-21 12:54:24 +03:00
rcS.template nsh/script: support rc.sysinit script 2022-04-21 12:54:24 +03:00