Diff for /libelwix/example/test_valid.c between versions 1.1 and 1.2

version 1.1, 2025/08/21 16:08:20 version 1.2, 2025/08/25 13:00:37
Line 0 Line 1
   #include <stdio.h>
   #include <elwix.h>
   
   
   int
   main(int argc, char **argv)
   {
           int pos = 0, started = 0;
           char line[BUFSIZ] = { 0 }, str[BUFSIZ] = { 0 }, str2[BUFSIZ];
           json_t json;
   
           if (argc > 1) {
                   printf("validate=%d\n", json_validate(argv[1], &started));
                   printf("started=%d\n", started);
           }
   
           printf("Input test JSON for marshaling> ");
           while (!feof(stdin)) {
                   fgets(line, sizeof line - 1, stdin);
                   strlcat(str, line, sizeof str);
   
                   if (json_validate(str, &started))
                           break;
           }
           strlcpy(str2, str, sizeof str2);
   
           json_init(&json, 0);
           printf("json_parse num tokens=%d\n", json_parse(&json, str, sizeof str, NULL, 0));
           json_free(&json);
   
           if (json_marshaling(str, 0))
                   printf("Marshaled JSON with spaces> %s\n", str);
           if (json_marshaling(str2, 1))
                   printf("Marshaled JSON> %s\n", str2);
           return 0;
   }

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>