commit 4315b20a4c3eb1d98f83ff0626e39fa58e1f6913 from: Omar Polo date: Thu Aug 05 17:44:55 2021 UTC add syntaxcheck option commit - 977482da105055c63043ca45adf824b636e79559 commit + 4315b20a4c3eb1d98f83ff0626e39fa58e1f6913 blob - 7f6230a16e3ec6c54c4abfa71b46d7558cf6c107 blob + ea597a776b6e7351a23b2d6b09b253286483c014 --- script.c +++ script.c @@ -48,6 +48,7 @@ static struct value v_true = {.type = V_NUM, .v = {.n static uint8_t lasttag; static int debug; +static int syntaxcheck; static inline void peekn(int depth, struct value *v) @@ -1021,13 +1022,16 @@ main(int argc, char **argv) add_builtin_proc("skip", builtin_skip, 0, 0); add_builtin_proc("iota", builtin_iota, 0, 0); - while ((ch = getopt(argc, argv, "v:")) != -1) { + while ((ch = getopt(argc, argv, "nv")) != -1) { switch (ch) { + case 'n': + syntaxcheck = 1; + break; case 'v': debug = 1; break; default: - fprintf(stderr, "Usage: %s [-v] [files...]\n", + fprintf(stderr, "Usage: %s [-nv] [files...]\n", *argv); exit(1); } @@ -1038,6 +1042,11 @@ main(int argc, char **argv) for (i = 0; i < argc; ++i) loadfile(argv[i]); + if (syntaxcheck) { + fprintf(stderr, "files OK\n"); + return 0; + } + i = 0; TAILQ_FOREACH(t, &tests, entry) { printf("===> running test \"%s\"... ", t->name);