common C code: add "-t" option for test mode.
This commit is contained in:
@@ -13,5 +13,5 @@
|
||||
#define _AOC_H_
|
||||
|
||||
extern int parseargs(int ac, char**av);
|
||||
|
||||
extern int testmode(void);
|
||||
#endif /* _AOC_H_ */
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user