nuttx-apps/system/nxinit
wangjianyu3 80ee6d845c system/nxinit: Handle trailing file '\0'
When ETC_ROMFS is disabled to reduce the bin size, we can provide the init.rc
file via a pseudo-file in the boards/vendor directory. For example:
  - CONFIG_ETC_ROMFS=n
  - CONFIG_PSEUDOFS_FILE=y
  - CONFIG_DISABLE_PSEUDOFS_OPERATIONS=n
  ```C
  FAR const char *init_rc =
    "on init\n"
    "    start console\n";
    "service console sh\n"
    "    restart_period 100\n";

  int fd = open("/etc/init.d/init.rc", O_WRONLY | O_CREAT);
  /* ... */
  ssize_t n = write(fd, init_rc, strlen(init_rc) + 1);
  /* ... */
  close(fd);
  ```

The last character '\0' in the file content will be treated as a new line,
and the number of parsed parameters will be zero (abnormal, there should be
at least one keyword).

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-06-17 23:19:01 +08:00
..
action.c system/nxinit: Warning for long commands 2026-05-27 17:20:07 -03:00
action.h system/nxinit: Warning for long commands 2026-05-27 17:20:07 -03:00
builtin.c system/nxinit: Add exec_start support for action 2026-05-27 17:20:07 -03:00
builtin.h system/nxinit: Add NuttX Init 2026-05-27 17:20:07 -03:00
CMakeLists.txt system/nxinit: Add NuttX Init 2026-05-27 17:20:07 -03:00
import.c system/nxinit: Add NuttX Init 2026-05-27 17:20:07 -03:00
import.h system/nxinit: Add NuttX Init 2026-05-27 17:20:07 -03:00
init.c apps/nxinit: Fix uninitialized variable 2026-05-28 01:08:11 -03:00
init.h system/nxinit: Change LOG_DEBUG to LOG_USER 2026-05-27 17:20:07 -03:00
Kconfig apps/nxinit: Make init.rc file path configurable 2026-05-28 01:08:11 -03:00
Make.defs system/nxinit: Add NuttX Init 2026-05-27 17:20:07 -03:00
Makefile system/nxinit: Add NuttX Init 2026-05-27 17:20:07 -03:00
parser.c system/nxinit: Handle trailing file '\0' 2026-06-17 23:19:01 +08:00
parser.h system/nxinit: Add NuttX Init 2026-05-27 17:20:07 -03:00
service.c apps/nxinit: Fix service length error 2026-05-28 01:08:11 -03:00
service.h system/nxinit: Let use a define to define the class max cmds 2026-05-27 17:20:07 -03:00