| 291 | } |
| 292 | |
| 293 | static void |
| 294 | try_exec_man (const char *page, char *relative_to) { |
| 295 | int status; |
| 296 | |
| 297 | switch (fork()) { |
| 298 | case -1: |
| 299 | err(1, "Forking man command"); |
| 300 | case 0: |
| 301 | /* child, run man command. */ |
| 302 | if (relative_to != NULL) { |
| 303 | page = tal_fmt(page, "%s/%s.7", relative_to, page); |
| 304 | execlp("man", "man", "-l", page, (char *)NULL); |
| 305 | } |
| 306 | else { |
| 307 | execlp("man", "man", page, (char *)NULL); |
| 308 | } |
| 309 | |
| 310 | err(1, "Running man command"); |
| 311 | default: |
| 312 | break; |
| 313 | } |
| 314 | |
| 315 | wait(&status); |
| 316 | if (WIFEXITED(status) && WEXITSTATUS(status) == 0) |
| 317 | exit(0); |
| 318 | } |
| 319 | |
| 320 | static void print_json(const char *str, const jsmntok_t *tok, const char *indent) |
| 321 | { |