Nicholas Flintham | 1e3d311 | 2013-04-10 10:48:38 +0100 | [diff] [blame^] | 1 | |
| 2 | |
| 3 | struct match_token { |
| 4 | int token; |
| 5 | const char *pattern; |
| 6 | }; |
| 7 | |
| 8 | typedef struct match_token match_table_t[]; |
| 9 | |
| 10 | enum {MAX_OPT_ARGS = 3}; |
| 11 | |
| 12 | typedef struct { |
| 13 | char *from; |
| 14 | char *to; |
| 15 | } substring_t; |
| 16 | |
| 17 | int match_token(char *, const match_table_t table, substring_t args[]); |
| 18 | int match_int(substring_t *, int *result); |
| 19 | int match_octal(substring_t *, int *result); |
| 20 | int match_hex(substring_t *, int *result); |
| 21 | size_t match_strlcpy(char *, const substring_t *, size_t); |
| 22 | char *match_strdup(const substring_t *); |