1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h>

#include "lexer.h"
#include "fmt_check_parser.h"
#include "fmt.h"
#include "testcase.h"

int
main(int argc, char **argv)
{
    if (argc != 3) {
        fprintf(stderr, "usage: %s fmt_check.txt check.c\n", argv[0]);
        return 1;
    }

    FILE *in = fopen(argv[1], "r");
    FILE *out = fopen(argv[2], "w");

    if (!in) {
        fprintf(stderr, "can not open input file '%s'\n", argv[1]);
        return 1;
    }
    if (!out) {
        fprintf(stderr, "can not open output file '%s'\n", argv[2]);
        return 1;
    }

    setLexerIn(in, argv[1]);

    parseFmtCheck();
    printTestCaseList(out);
}