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

@@ -33,6 +33,8 @@
#include <stdbool.h>
#include <errno.h>
#include <nuttx/queue.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -119,6 +121,14 @@ struct nsh_vtbl_s
char iobuffer[IOBUFFERSIZE];
#endif
#ifdef CONFIG_NSH_ALIAS
/* Shell alias support */
struct nsh_alias_s atab[CONFIG_NSH_ALIAS_MAX_AMOUNT];
struct sq_queue_s alist;
struct sq_queue_s afreelist;
#endif
/* Parser state data */
struct nsh_parser_s np;