| 237 | } |
| 238 | |
| 239 | static struct bolt_file *find_bolt(const char *bolt_prefix, |
| 240 | struct bolt_file *bolts) |
| 241 | { |
| 242 | size_t i, n = tal_count(bolts); |
| 243 | int boltnum; |
| 244 | char *endp; |
| 245 | |
| 246 | for (i = 0; i < n; i++) |
| 247 | if (streq(bolts[i].prefix, bolt_prefix)) |
| 248 | return bolts+i; |
| 249 | |
| 250 | /* Now search for numerical match. */ |
| 251 | boltnum = strtol(bolt_prefix, &endp, 10); |
| 252 | if (endp != bolt_prefix && *endp == 0) { |
| 253 | for (i = 0; i < n; i++) |
| 254 | if (atoi(bolts[i].prefix) == boltnum) |
| 255 | return bolts+i; |
| 256 | } |
| 257 | |
| 258 | return NULL; |
| 259 | } |
| 260 | |
| 261 | int main(int argc, char *argv[]) |
| 262 | { |