projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
yaz-iconv: fix typos
[yaz-moved-to-github.git]
/
util
/
json-parse.c
diff --git
a/util/json-parse.c
b/util/json-parse.c
index
ce1da8b
..
99a766c
100644
(file)
--- a/
util/json-parse.c
+++ b/
util/json-parse.c
@@
-1,7
+1,10
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) Index Data
* See the file LICENSE for details.
*/
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
@@
-10,6
+13,7
@@
#include <yaz/json.h>
#include <yaz/wrbuf.h>
#include <yaz/options.h>
#include <yaz/json.h>
#include <yaz/wrbuf.h>
#include <yaz/options.h>
+#include <yaz/backtrace.h>
void usage(const char *prog)
{
void usage(const char *prog)
{
@@
-47,12
+51,14
@@
int main(int argc, char **argv)
int print = 0;
int ret;
char *arg;
int print = 0;
int ret;
char *arg;
+
+ yaz_enable_panic_backtrace(*argv);
while ((ret = options("p", argv, argc, &arg)) != YAZ_OPTIONS_EOF)
{
switch (ret)
{
case 'p':
while ((ret = options("p", argv, argc, &arg)) != YAZ_OPTIONS_EOF)
{
switch (ret)
{
case 'p':
- print = 1;
+ print++;
break;
default:
usage(argv[0]);
break;
default:
usage(argv[0]);
@@
-64,7
+70,10
@@
int main(int argc, char **argv)
if (print)
{
WRBUF result = wrbuf_alloc();
if (print)
{
WRBUF result = wrbuf_alloc();
- json_write_wrbuf(n, result);
+ if (print > 1)
+ json_write_wrbuf_pretty(n, result);
+ else
+ json_write_wrbuf(n, result);
puts(wrbuf_cstr(result));
wrbuf_destroy(result);
}
puts(wrbuf_cstr(result));
wrbuf_destroy(result);
}