1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2010 Index Data
3 * See the file LICENSE for details.
11 #include <yaz/wrbuf.h>
12 #include <yaz/options.h>
14 void usage(const char *prog)
16 fprintf(stderr, "%s: [-p]\n", prog);
20 static struct json_node *do_parse_from_stdin(void)
23 WRBUF w = wrbuf_alloc();
29 while ((c = getc(f)) != EOF)
31 json_str = wrbuf_cstr(w);
32 n = json_parse(json_str, &err_msg);
34 fprintf(stderr, "JSON parse error: %s\n", err_msg);
39 int main(int argc, char **argv)
45 while ((ret = options("p", argv, argc, &arg)) != YAZ_OPTIONS_EOF)
56 n = do_parse_from_stdin();
61 WRBUF result = wrbuf_alloc();
62 json_write_wrbuf(n, result);
63 puts(wrbuf_cstr(result));
64 wrbuf_destroy(result);
72 * c-file-style: "Stroustrup"
73 * indent-tabs-mode: nil
75 * vim: shiftwidth=4 tabstop=8 expandtab