Skip to content

Commit

Permalink
Fall back to running man without -W since some implementations don't …
Browse files Browse the repository at this point in the history
…allow that

Fixes baszoetekouw#12.

Change courtesy of loreb: baszoetekouw#12 (comment)
  • Loading branch information
whitelynx committed Jun 9, 2024
1 parent 3d76eec commit 032dbfc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/manual.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,14 @@ set_initial_history(char *name)
pathFile = popen(buf, "r");
if (fgets(buf, sizeof(buf), pathFile)==NULL)
{
fprintf(stderr, "Error executing command '%s'\n", buf);
exit(1);
/* Try without -W */
snprintf(buf, sizeof(buf), "man -w %s %s", ManOptions, name);
pathFile = popen(buf, "r");
if (fgets(buf, sizeof(buf), pathFile)==NULL)
{
fprintf(stderr, "Error executing command '%s'\n", buf);
exit(1);
}
}
pclose(pathFile);
/* buf will be of the form "/usr/share/man/man1/sleep.1.gz". We
Expand Down

0 comments on commit 032dbfc

Please sign in to comment.