30 } |
30 } |
31 |
31 |
32 |
32 |
33 static bool test2_fn(Tokenizer *tokz, int n, Token *toks) |
33 static bool test2_fn(Tokenizer *tokz, int n, Token *toks) |
34 { |
34 { |
35 printf("test2_fn() %d %ld %f\n", n, TOK_LONG_VAL(toks+1), TOK_DOUBLE_VAL(toks+2)); |
35 printf("test2_fn() %d %s %f\n", n, TOK_BOOL_VAL(toks+1) ? "TRUE" : "FALSE", TOK_DOUBLE_VAL(toks+2)); |
36 |
36 |
37 return TRUE; |
37 return TRUE; |
38 } |
38 } |
39 |
39 |
40 static bool test3_fn(Tokenizer *tokz, int n, Token *toks) |
40 static bool test3_fn(Tokenizer *tokz, int n, Token *toks) |
48 } |
48 } |
49 |
49 |
50 |
50 |
51 static ConfOpt opts[]={ |
51 static ConfOpt opts[]={ |
52 {"test", NULL, test_fn, NULL}, |
52 {"test", NULL, test_fn, NULL}, |
53 {"t2", "ld", test2_fn, NULL}, |
53 {"t2", "bd", test2_fn, NULL}, |
54 {"foo", "s?l", test3_fn, NULL}, |
54 {"foo", "s?l", test3_fn, NULL}, |
55 {"sect", "s", sect_fn, opts}, |
55 {"sect", "s", sect_fn, opts}, |
56 {NULL, NULL, NULL, NULL} |
56 {NULL, NULL, NULL, NULL} |
57 }; |
57 }; |
58 |
58 |
59 |
59 |
60 int main(int argc, char *argv[]) |
60 int main(int argc, char *argv[]) |
61 { |
61 { |
62 libtu_init_argv0(argv[0], NULL); |
62 libtu_init(argv[0]); |
63 parse_config_file(stdin, opts, TOKZ_ERROR_TOLERANT); |
63 parse_config_file(stdin, opts, TOKZ_ERROR_TOLERANT); |
64 |
64 |
65 return EXIT_SUCCESS; |
65 return EXIT_SUCCESS; |
66 } |
66 } |
67 |
67 |