Wed, 19 Apr 2000 22:44:45 +0200
trunk: changeset 10
Fixed system.mk
| 0 | 1 | /* |
| 2 | * libtu/tester2.c | |
| 3 | * | |
| 4 | * Copyright (c) Tuomo Valkonen 1999-2000. | |
| 5 | * | |
| 6 | * This file is distributed under the terms of the "Artistic License". | |
| 7 | * See the included file LICENSE for details. | |
| 8 | */ | |
| 9 | ||
| 10 | #include <stdio.h> | |
| 5 | 11 | |
| 12 | #include <libtu/misc.h> | |
| 13 | #include <libtu/tokenizer.h> | |
| 14 | #include <libtu/parser.h> | |
| 15 | #include <libtu/util.h> | |
| 0 | 16 | |
| 17 | ||
| 18 | static bool test_fn(Tokenizer *tokz, int n, Token *toks) | |
| 19 | { | |
| 20 | printf("test_fn() %d %s\n", n, TOK_IDENT_VAL(toks)); | |
| 21 | ||
| 22 | return TRUE; | |
| 23 | } | |
| 24 | ||
| 25 | ||
| 26 | ||
| 27 | static bool sect_fn(Tokenizer *tokz, int n, Token *toks) | |
| 28 | { | |
| 29 | printf("sect_fn() %d %s\n", n, TOK_IDENT_VAL(toks+1)); | |
| 30 | ||
| 31 | return TRUE; | |
| 32 | } | |
| 33 | ||
| 34 | ||
| 35 | static bool test2_fn(Tokenizer *tokz, int n, Token *toks) | |
| 36 | { | |
| 37 | printf("test2_fn() %d %ld %f\n", n, TOK_LONG_VAL(toks+1), TOK_DOUBLE_VAL(toks+2)); | |
| 38 | ||
| 39 | return TRUE; | |
| 40 | } | |
| 41 | ||
| 42 | static bool test3_fn(Tokenizer *tokz, int n, Token *toks) | |
| 43 | { | |
| 2 | 44 | if(n<=2) |
| 45 | printf("test3_fn() %d \"%s\"\n", n, TOK_STRING_VAL(toks+1)); | |
| 0 | 46 | else |
| 2 | 47 | printf("test3_fn() %d \"%s\" %ld\n", n, TOK_STRING_VAL(toks+1), TOK_LONG_VAL(toks+2)); |
| 0 | 48 | |
| 49 | return TRUE; | |
| 50 | } | |
| 51 | ||
| 52 | ||
| 53 | static ConfOpt opts[]={ | |
| 54 | {"test", NULL, test_fn, NULL}, | |
| 55 | {"t2", "ld", test2_fn, NULL}, | |
| 56 | {"foo", "s?l", test3_fn, NULL}, | |
| 57 | {"sect", "s", sect_fn, opts}, | |
| 58 | {NULL, NULL, NULL, NULL} | |
| 59 | }; | |
| 60 | ||
| 61 | ||
| 62 | int main(int argc, char *argv[]) | |
| 63 | { | |
| 64 | libtu_init_argv0(argv[0], NULL); | |
| 2 | 65 | parse_config_file(stdin, opts, TOKZ_ERROR_TOLERANT); |
| 0 | 66 | |
| 67 | return EXIT_SUCCESS; | |
| 68 | } | |
| 69 |