aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2015-02-11 17:56:24 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2015-02-11 17:56:24 +0000
commit399d34850fe953934b6516ac78dfc3c7aed1e10f (patch)
tree700902b197a7740742e27e6af669f88b7bb77821
parentec6c61d89638328fc20474fbf478bde612220b13 (diff)
downloadsrc-399d34850fe953934b6516ac78dfc3c7aed1e10f.tar.gz
src-399d34850fe953934b6516ac78dfc3c7aed1e10f.zip
Close the file list before opening the container that holds the
totals, otherwise we end up emitting invalid JSON -- provided libxo does not prevent us from doing that. PR: 197499 Submitted by: allanjude@
Notes
Notes: svn path=/head/; revision=278590
-rw-r--r--usr.bin/wc/wc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c
index 79ac4a020f3d..9d51ab2fd1c8 100644
--- a/usr.bin/wc/wc.c
+++ b/usr.bin/wc/wc.c
@@ -140,12 +140,14 @@ main(int argc, char *argv[])
} while(*++argv);
}
+ xo_close_list("file");
+
if (total > 1) {
xo_open_container("total");
show_cnt("total", tlinect, twordct, tcharct, tlongline);
xo_close_container("total");
}
- xo_close_list("file");
+
xo_close_container("wc");
xo_finish();
exit(errors == 0 ? 0 : 1);