nsh/nshlib: Add alias support for nsh

This adds support for string aliases into nsh. There are some nuances that
are not handled correctly yet:

- Reserved words can be overloaded, which is a clear POSIX violation
This commit is contained in:
Ville Juven
2023-02-22 18:19:59 +02:00
committed by Petro Karashchenko
parent bf40833d2e
commit f9dfb51001
7 changed files with 683 additions and 36 deletions

View File

@@ -104,6 +104,13 @@ static const struct cmdmap_s g_cmdmap[] =
{ "addroute", cmd_addroute, 3, 4, "<target> [<netmask>] <router>" },
#endif
#ifdef CONFIG_NSH_ALIAS
{ "alias", cmd_alias, 1, CONFIG_NSH_MAXARGUMENTS,
"[name[=value] ... ]" },
{ "unalias", cmd_unalias, 1, CONFIG_NSH_MAXARGUMENTS,
"[-a] name [name ... ]" },
#endif
#if defined(CONFIG_NET) && defined(CONFIG_NET_ARP) && !defined(CONFIG_NSH_DISABLE_ARP)
{ "arp", cmd_arp, 1, 6,
"[-i <ifname>] [-a <ipaddr>|-d <ipaddr>|-s <ipaddr> <hwaddr>]" },