Refactored cli-syntax code to use cligen pt_head instead (long overdue)

This commit is contained in:
Olof hagsand 2023-06-28 13:44:06 +02:00
parent e1a8e0d40b
commit b39ee078c4
7 changed files with 124 additions and 274 deletions

View file

@ -87,7 +87,6 @@ struct cli_handle {
/* ------ end of common handle ------ */
cligen_handle cl_cligen; /* cligen handle */
cli_syntax_t *cl_stx; /* CLI syntax structure */
};
/*! Return a clicon handle for other CLICON API calls
@ -121,14 +120,9 @@ int
cli_handle_exit(clicon_handle h)
{
cligen_handle ch = cligen(h);
struct cli_handle *cl = handle(h);
if (cl->cl_stx)
free(cl->cl_stx);
clicon_handle_exit(h); /* frees h and options */
cligen_exit(ch);
return 0;
}
@ -136,28 +130,6 @@ cli_handle_exit(clicon_handle h)
* cli-specific handle access functions
*----------------------------------------------------------*/
/*! Get current syntax-group */
cli_syntax_t *
cli_syntax(clicon_handle h)
{
struct cli_handle *cl = handle(h);
return cl->cl_stx;
}
/*! Set current syntax-group */
int
cli_syntax_set(clicon_handle h,
cli_syntax_t *stx)
{
struct cli_handle *cl = handle(h);
if (cl->cl_stx)
free(cl->cl_stx);
cl->cl_stx = stx;
return 0;
}
/*! Return clicon handle */
cligen_handle
cli_cligen(clicon_handle h)