| 195 | } |
| 196 | |
| 197 | void opt_register_table(const struct opt_table entry[], const char *desc) |
| 198 | { |
| 199 | unsigned int i, start = opt_count; |
| 200 | |
| 201 | if (desc) { |
| 202 | struct opt_table heading = OPT_SUBTABLE(NULL, desc); |
| 203 | add_opt(&heading); |
| 204 | } |
| 205 | for (i = 0; entry[i].type != OPT_END; i++) { |
| 206 | if (entry[i].type == OPT_SUBTABLE) |
| 207 | opt_register_table(subtable_of(&entry[i]), |
| 208 | entry[i].desc); |
| 209 | else { |
| 210 | check_opt(&entry[i]); |
| 211 | add_opt(&entry[i]); |
| 212 | } |
| 213 | } |
| 214 | /* We store the table length in arg ptr. */ |
| 215 | if (desc) |
| 216 | opt_table[start].u.tlen = (opt_count - start); |
| 217 | } |
| 218 | |
| 219 | /* Parse your arguments. */ |
| 220 | bool opt_parse(int *argc, char *argv[], void (*errlog)(const char *fmt, ...)) |