Commit 24ebdb55 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

print also built-in init script with _init show_ cmd

parent fda53d29
......@@ -694,6 +694,7 @@ int storage_init_show(void)
if (sdbfs_open_id(&wrc_sdb, SDB_VENDOR, SDB_DEV_INIT) < 0)
return -1;
pp_printf("-- user-defined script --\n");
used = 0;
do {
if (sdbfs_fread(&wrc_sdb, sizeof(used) + used, &byte, 1) != 1)
......@@ -705,7 +706,7 @@ int storage_init_show(void)
} while (byte != 0xff);
if (used == 0)
pp_printf("Empty init script...\n");
pp_printf("(empty)\n");
ret = 0;
out:
sdbfs_close(&wrc_sdb);
......
......@@ -39,5 +39,6 @@ int shell_interactive(void);
extern int shell_is_interacting;
void shell_boot_script(void);
void shell_show_build_init(void);
#endif
......@@ -25,6 +25,7 @@ static int cmd_init(const char *args[])
else
pp_printf("OK.\n");
} else if (args[0] && !strcasecmp(args[0], "show")) {
shell_show_build_init();
storage_init_show();
} else if (args[0] && !strcasecmp(args[0], "boot")) {
shell_boot_script();
......
......@@ -278,6 +278,11 @@ static int build_init_readcmd(uint8_t *cmd, int maxlen)
p += i;
if (*p == ';')
p++;
if (i == 0) {
/* it's the last call, roll-back *p to be ready for the next
* call */
p = shell_init_cmd;
}
return i;
}
......@@ -314,3 +319,20 @@ void shell_boot_script(void)
return;
}
void shell_show_build_init(void)
{
uint8_t i = 0;
pp_printf("-- built-in script --\n");
while (CONFIG_HAS_BUILD_INIT) {
cmd_len = build_init_readcmd((uint8_t *)cmd_buf,
SH_MAX_LINE_LEN);
if (!cmd_len)
break;
pp_printf("%s\n", cmd_buf);
++i;
}
if (!i)
pp_printf("(empty)\n");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment