35 lines
589 B
C
35 lines
589 B
C
#include "aliases.h"
|
|
#include "lexer.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
if (argc < 2) {
|
|
printf("NO FILE PROVIDED\n");
|
|
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
const char *filename = argv[1];
|
|
|
|
FILE *fp = fopen(filename, "r");
|
|
|
|
fseek(fp, 0, SEEK_END);
|
|
|
|
u64 length = ftell(fp);
|
|
|
|
fseek(fp, 0, SEEK_SET);
|
|
|
|
char json[length + 1];
|
|
memset(json, 0, length + 1);
|
|
|
|
fread(json, sizeof(char), length, fp);
|
|
|
|
fclose(fp);
|
|
|
|
printf("\n%35s: %s\n", filename, validate_json(json) ? "VALID" : "INVALID");
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|