* Added new cli show functions to work with cligen_output for cligen pageing to work. To acheive this, add a callback function as follows:

* xml2txt(...) --> xml2txt_cb(..., cligen_output)
  * xml2cli(...) --> xml2cli_cb(..., cligen_output)
  * clicon_xml2file(...) --> clicon_xml2file_cb(..., cligen_output)
  * xml2json(...) --> xml2json_cb(..., cligen_output)
  * yang_print(...) --> yang_print_cb(..., cligen_output)
This commit is contained in:
Olof hagsand 2020-06-17 14:04:19 +02:00
parent 6e714beea5
commit 0adcd94f3f
13 changed files with 291 additions and 114 deletions

View file

@ -1245,13 +1245,15 @@ quotedstring(char *s)
}
/*! Print yang specification to file
* @param[in] f File to print to.
* @param[in] yn Yang node to print
* @param[in] f File to print to.
* @param[in] yn Yang node to print
* @param[in] fn Callback to make print function
* @see yang_print_cbuf
*/
int
yang_print(FILE *f,
yang_stmt *yn)
yang_print_cb(FILE *f,
yang_stmt *yn,
clicon_output_cb *fn)
{
int retval = -1;
cbuf *cb = NULL;
@ -1262,7 +1264,7 @@ yang_print(FILE *f,
}
if (yang_print_cbuf(cb, yn, 0) < 0)
goto done;
fprintf(f, "%s", cbuf_get(cb));
(*fn)(f, "%s", cbuf_get(cb));
if (cb)
cbuf_free(cb);
retval = 0;
@ -1270,6 +1272,18 @@ yang_print(FILE *f,
return retval;
}
/*! Print yang specification to file
* @param[in] f File to print to.
* @param[in] yn Yang node to print
* @see yang_print_cbuf
*/
int
yang_print(FILE *f,
yang_stmt *yn)
{
return yang_print_cb(f, yn, fprintf);
}
/*! Print yang specification to cligen buf
* @param[in] cb Cligen buffer. This is where the pretty print is.
* @param[in] yn Yang node to print