From: Eric Hawicz Date: Sat, 9 May 2020 02:25:15 +0000 (-0400) Subject: Merge branch 'master' of https://github.com/json-c/json-c X-Git-Tag: json-c-0.15-20200726~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=45b6416652755f488ee1240fecc6fd935029c8f9;p=thirdparty%2Fjson-c.git Merge branch 'master' of https://github.com/json-c/json-c --- 45b6416652755f488ee1240fecc6fd935029c8f9 diff --cc apps/json_parse.c index a48017bd,59bf10ab..bba46221 --- a/apps/json_parse.c +++ b/apps/json_parse.c @@@ -167,17 -167,15 +167,16 @@@ int main(int argc, char **argv case 'f': formatted_output = 1; break; case 'n': show_output = 0; break; case 's': strict_mode = 1; break; - default: /* '?' */ usage(argv[0], EXIT_FAILURE, NULL); + case 'h': usage(argv[0], 0, NULL); - default: /* '?' */ usage(argv[0], 1, "Unknown arguments"); ++ default: /* '?' */ usage(argv[0], EXIT_FAILURE, "Unknown arguments"); } } - if (optind >= argc) { - fprintf(stderr, "Expected argument after options\n"); - exit(EXIT_FAILURE); + usage(argv[0], EXIT_FAILURE, "Expected argument after options"); } fname = argv[optind]; + int fd = open(argv[optind], O_RDONLY, 0); showmem(); if (parseit(fd, showobj) != 0)