mirror of
https://github.com/void-linux/void-packages.git
synced 2025-04-22 09:07:01 +02:00
To show a man page (e.g. when there is no info file) this program uses `man -w -W <name>` but option `-W` is unsupported by our `man(1)`. This results in: $ pinfo man man: BADARG: bad command line argument: -W man Error executing command 'man -w -W man' and the terminal is left in a broken state. Fix by applying this PR: https://github.com/baszoetekouw/pinfo/pull/36
57 lines
1.8 KiB
Diff
57 lines
1.8 KiB
Diff
From 032dbfc4bf9ff45719de64d251244ab1307db17c Mon Sep 17 00:00:00 2001
|
|
From: "David H. Bronke" <whitelynx@gmail.com>
|
|
Date: Sun, 9 Jun 2024 12:12:05 +0200
|
|
Subject: [PATCH 1/2] Fall back to running man without -W since some
|
|
implementations don't allow that
|
|
|
|
Fixes #12.
|
|
|
|
Change courtesy of loreb: https://github.com/baszoetekouw/pinfo/issues/12#issuecomment-884322986
|
|
---
|
|
src/manual.c | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/manual.c b/src/manual.c
|
|
index 5f058ff..791df32 100644
|
|
--- a/src/manual.c
|
|
+++ b/src/manual.c
|
|
@@ -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
|
|
|
|
From c3722aa478420b6671ed932503e06886e04d4287 Mon Sep 17 00:00:00 2001
|
|
From: "David H. Bronke" <whitelynx@gmail.com>
|
|
Date: Sat, 29 Jun 2024 14:55:46 +0200
|
|
Subject: [PATCH 2/2] fix(src/manual.c): close pathFile before reopening
|
|
|
|
Suggested by @xaizek
|
|
---
|
|
src/manual.c | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/src/manual.c b/src/manual.c
|
|
index 791df32..bb730ee 100644
|
|
--- a/src/manual.c
|
|
+++ b/src/manual.c
|
|
@@ -186,6 +186,7 @@ set_initial_history(char *name)
|
|
pathFile = popen(buf, "r");
|
|
if (fgets(buf, sizeof(buf), pathFile)==NULL)
|
|
{
|
|
+ pclose(pathFile);
|
|
/* Try without -W */
|
|
snprintf(buf, sizeof(buf), "man -w %s %s", ManOptions, name);
|
|
pathFile = popen(buf, "r");
|