diff --git a/2022/day15/aoc.h b/2022/day15/aoc.h index 2ef8361..fb6f19a 100644 --- a/2022/day15/aoc.h +++ b/2022/day15/aoc.h @@ -13,5 +13,5 @@ #define _AOC_H_ extern int parseargs(int ac, char**av); - +extern int testmode(void); #endif /* _AOC_H_ */ diff --git a/2022/day15/common.c b/2022/day15/common.c index a3827b6..d8ac20b 100644 --- a/2022/day15/common.c +++ b/2022/day15/common.c @@ -17,18 +17,28 @@ #include "aoc.h" #include "debug.h" +static int _testmode = 0; + static int usage(char *prg) { - fprintf(stderr, "Usage: %s [-d debug_level] [-p part] [-i input]\n", prg); + fprintf(stderr, "Usage: %s [-t][-d debug_level] [-p part] [-i input]\n", prg); return 1; } +int testmode(void) +{ + return _testmode; +} + int parseargs(int ac, char **av) { int opt, part = 1; - while ((opt = getopt(ac, av, "d:p:")) != -1) { + while ((opt = getopt(ac, av, "td:p:")) != -1) { switch (opt) { + case 't': + _testmode = 1; + break; case 'd': debug_level_set(atoi(optarg)); break;