Skip to content

Commit

Permalink
comment switch in json_verify.
Browse files Browse the repository at this point in the history
git-svn-id: http://yajl-c.googlecode.com/svn/yajl/trunk@65 e775cfb5-b74b-0410-aad5-5bebe4a96390
  • Loading branch information
lloydh committed Jul 25, 2007
1 parent e73ed52 commit 9cd38cb
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions verify/json_verify.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ static void
usage(const char * progname)
{
fprintf(stderr, "usage: %s\n"
" -q quiet mode\n", progname);
" -q quiet mode\n"
" -c allow comments\n",
progname);
exit(1);
}

Expand All @@ -56,9 +58,19 @@ main(int argc, char ** argv)
yajl_parser_config cfg = { 0 };

/* check arguments.*/
/* XXX: comment flag! */
if (argc == 2 && !strcmp("-q", argv[1])) {
quiet = 1;
if (argc > 1 && argc < 4) {
unsigned int i;

for (i=1; i < argc;i++) {
if (!strcmp("-q", argv[i])) {
quiet = 1;
} else if (!strcmp("-c", argv[i])) {
cfg.allowComments = 1;
} else {
fprintf(stderr, "unrecognized option: '%s'\n\n", argv[i]);
usage(argv[0]);
}
}
} else if (argc != 1) {
usage(argv[0]);
}
Expand Down

0 comments on commit 9cd38cb

Please sign in to comment.