completing the function of hide for autocli-op in the yang files

This commit is contained in:
shmuels 2021-04-21 15:15:35 +03:00
parent 33ad428854
commit b0c5e43d50
4 changed files with 7 additions and 7 deletions

View file

@ -521,10 +521,10 @@ cli_auto_show(clicon_handle h,
switch (format){ switch (format){
case FORMAT_XML: case FORMAT_XML:
if (isroot) if (isroot)
stdout(xp, 0, pretty, 1); xml2file(xp, 0, pretty, fprintf);
else{ else{
while ((xc = xml_child_each(xp, xc, CX_ELMNT)) != NULL) while ((xc = xml_child_each(xp, xc, CX_ELMNT)) != NULL)
stdout(xc, 0, pretty, 1); xml2file(xc, 0, pretty, fprintf);
} }
fprintf(stdout, "\n"); fprintf(stdout, "\n");
break; break;

View file

@ -1043,7 +1043,7 @@ xmldb_put(clicon_handle h,
if (xml2json(f, x0, pretty) < 0) if (xml2json(f, x0, pretty) < 0)
goto done; goto done;
} }
else if (clicon_xml2file(f, x0, 0, pretty, 0) < 0) else if (clicon_xml2file(f, x0, 0, pretty) < 0)
goto done; goto done;
/* Remove modules state after writing to file /* Remove modules state after writing to file
*/ */
@ -1101,7 +1101,7 @@ xmldb_dump(clicon_handle h,
if (xml2json(f, xt, pretty) < 0) if (xml2json(f, xt, pretty) < 0)
goto done; goto done;
} }
else if (clicon_xml2file(f, xt, 0, pretty, 0) < 0) else if (clicon_xml2file(f, xt, 0, pretty) < 0)
goto done; goto done;
retval = 0; retval = 0;
done: done:

View file

@ -94,7 +94,6 @@
* @param[in] level how many spaces to insert before each line * @param[in] level how many spaces to insert before each line
* @param[in] prettyprint insert \n and spaces tomake the xml more readable. * @param[in] prettyprint insert \n and spaces tomake the xml more readable.
* @param[in] fn Callback to make print function * @param[in] fn Callback to make print function
* @param[in] used_for_show_command is the function used for a cli show command.
* @see clicon_xml2cbuf * @see clicon_xml2cbuf
* One can use clicon_xml2cbuf to get common code, but using fprintf is * One can use clicon_xml2cbuf to get common code, but using fprintf is
* much faster than using cbuf and then printing that,... * much faster than using cbuf and then printing that,...
@ -114,6 +113,7 @@ xml2file_recurse(FILE *f,
int haselement; int haselement;
char *val; char *val;
char *encstr = NULL; /* xml encoded string */ char *encstr = NULL; /* xml encoded string */
if (x == NULL) if (x == NULL)
goto ok; goto ok;
name = xml_name(x); name = xml_name(x);

View file

@ -205,7 +205,7 @@ main(int argc, char **argv)
xpath = "/"; xpath = "/";
if (xmldb_get(h, db, NULL, xpath, &xt) < 0) if (xmldb_get(h, db, NULL, xpath, &xt) < 0)
goto done; goto done;
clicon_xml2file(stdout, xt, 0, 0, 0); clicon_xml2file(stdout, xt, 0, 0);
fprintf(stdout, "\n"); fprintf(stdout, "\n");
if (xt){ if (xt){
xml_free(xt); xml_free(xt);
@ -228,7 +228,7 @@ main(int argc, char **argv)
clicon_err(OE_DB, 0, "xt is NULL"); clicon_err(OE_DB, 0, "xt is NULL");
goto done; goto done;
} }
clicon_xml2file(stdout, xt, 0, 0, 0); clicon_xml2file(stdout, xt, 0, 0);
if (xt){ if (xt){
xml_free(xt); xml_free(xt);
xt = NULL; xt = NULL;