Added final \n to JSON pretty-print output
This was a correction of fix to: [CLI Show config JSON with multiple top-level elements is broken](https://github.com/clicon/clixon/issues/381)
This commit is contained in:
parent
83f71529d7
commit
c93f264215
2 changed files with 1 additions and 14 deletions
|
|
@ -436,8 +436,6 @@ cli_show_common(clicon_handle h,
|
||||||
cxobj **vec = NULL;
|
cxobj **vec = NULL;
|
||||||
size_t veclen;
|
size_t veclen;
|
||||||
cxobj *xp;
|
cxobj *xp;
|
||||||
yang_stmt *yp;
|
|
||||||
enum rfc_6020 ys_keyword;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (state && strcmp(db, "running") != 0){
|
if (state && strcmp(db, "running") != 0){
|
||||||
|
|
@ -471,11 +469,6 @@ cli_show_common(clicon_handle h,
|
||||||
if (xpath_vec(xt, nsc, "%s", &vec, &veclen, xpath) < 0)
|
if (xpath_vec(xt, nsc, "%s", &vec, &veclen, xpath) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (veclen){
|
if (veclen){
|
||||||
xp = vec[0]; /* First peek to see if it is special case yang list */
|
|
||||||
if ((yp = xml_spec(xp)) != NULL)
|
|
||||||
ys_keyword = yang_keyword_get(xml_spec(xp));
|
|
||||||
else
|
|
||||||
ys_keyword = 0;
|
|
||||||
/* Special case LIST */
|
/* Special case LIST */
|
||||||
if (format == FORMAT_JSON){
|
if (format == FORMAT_JSON){
|
||||||
switch (format){
|
switch (format){
|
||||||
|
|
@ -490,10 +483,6 @@ cli_show_common(clicon_handle h,
|
||||||
else /* Default */
|
else /* Default */
|
||||||
for (i=0; i<veclen; i++){
|
for (i=0; i<veclen; i++){
|
||||||
xp = vec[i];
|
xp = vec[i];
|
||||||
if ((yp = xml_spec(xp)) != NULL)
|
|
||||||
ys_keyword = yang_keyword_get(xml_spec(xp));
|
|
||||||
else
|
|
||||||
ys_keyword = 0;
|
|
||||||
/* Print configuration according to format */
|
/* Print configuration according to format */
|
||||||
switch (format){
|
switch (format){
|
||||||
case FORMAT_XML:
|
case FORMAT_XML:
|
||||||
|
|
|
||||||
|
|
@ -1344,9 +1344,7 @@ xml2json_vec(FILE *f,
|
||||||
}
|
}
|
||||||
if (xml2json_cbuf_vec(cb, vec, veclen, pretty, skiptop) < 0)
|
if (xml2json_cbuf_vec(cb, vec, veclen, pretty, skiptop) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
fprintf(f, "%s", cbuf_get(cb));
|
fprintf(f, "%s\n", cbuf_get(cb));
|
||||||
if (!pretty)
|
|
||||||
fprintf(f, "\n");
|
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
if (cb)
|
if (cb)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue