diff --git a/apps/cli/cli_auto.c b/apps/cli/cli_auto.c index a9b15a5d..7e31db58 100644 --- a/apps/cli/cli_auto.c +++ b/apps/cli/cli_auto.c @@ -521,10 +521,10 @@ cli_auto_show(clicon_handle h, switch (format){ case FORMAT_XML: if (isroot) - stdout(xp, 0, pretty, 1); + xml2file(xp, 0, pretty, fprintf); else{ while ((xc = xml_child_each(xp, xc, CX_ELMNT)) != NULL) - stdout(xc, 0, pretty, 1); + xml2file(xc, 0, pretty, fprintf); } fprintf(stdout, "\n"); break; diff --git a/lib/src/clixon_datastore_write.c b/lib/src/clixon_datastore_write.c index 5945d8fa..a4425258 100644 --- a/lib/src/clixon_datastore_write.c +++ b/lib/src/clixon_datastore_write.c @@ -1043,7 +1043,7 @@ xmldb_put(clicon_handle h, if (xml2json(f, x0, pretty) < 0) goto done; } - else if (clicon_xml2file(f, x0, 0, pretty, 0) < 0) + else if (clicon_xml2file(f, x0, 0, pretty) < 0) goto done; /* Remove modules state after writing to file */ @@ -1101,7 +1101,7 @@ xmldb_dump(clicon_handle h, if (xml2json(f, xt, pretty) < 0) goto done; } - else if (clicon_xml2file(f, xt, 0, pretty, 0) < 0) + else if (clicon_xml2file(f, xt, 0, pretty) < 0) goto done; retval = 0; done: diff --git a/lib/src/clixon_xml_io.c b/lib/src/clixon_xml_io.c index a4a89577..d51bdc60 100644 --- a/lib/src/clixon_xml_io.c +++ b/lib/src/clixon_xml_io.c @@ -94,7 +94,6 @@ * @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] fn Callback to make print function - * @param[in] used_for_show_command is the function used for a cli show command. * @see clicon_xml2cbuf * One can use clicon_xml2cbuf to get common code, but using fprintf is * much faster than using cbuf and then printing that,... @@ -114,6 +113,7 @@ xml2file_recurse(FILE *f, int haselement; char *val; char *encstr = NULL; /* xml encoded string */ + if (x == NULL) goto ok; name = xml_name(x); diff --git a/util/clixon_util_datastore.c b/util/clixon_util_datastore.c index 8b8207a9..65e611f2 100644 --- a/util/clixon_util_datastore.c +++ b/util/clixon_util_datastore.c @@ -205,7 +205,7 @@ main(int argc, char **argv) xpath = "/"; if (xmldb_get(h, db, NULL, xpath, &xt) < 0) goto done; - clicon_xml2file(stdout, xt, 0, 0, 0); + clicon_xml2file(stdout, xt, 0, 0); fprintf(stdout, "\n"); if (xt){ xml_free(xt); @@ -228,7 +228,7 @@ main(int argc, char **argv) clicon_err(OE_DB, 0, "xt is NULL"); goto done; } - clicon_xml2file(stdout, xt, 0, 0, 0); + clicon_xml2file(stdout, xt, 0, 0); if (xt){ xml_free(xt); xt = NULL;