Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showing man page fails when info not found #12

Open
beginner3456789 opened this issue Feb 5, 2020 · 4 comments · May be fixed by #36
Open

Showing man page fails when info not found #12

beginner3456789 opened this issue Feb 5, 2020 · 4 comments · May be fixed by #36

Comments

@beginner3456789
Copy link

The call to the man program has man -W and there is no option for man -W causing an error.

In manual.c at line 185 looks like the problem:

snprintf(buf, sizeof(buf), "man -w -W %s %s", ManOptions, name);

Maybe -C for configuration. This is a problem when the info page is not found.

@loreb
Copy link

loreb commented Jul 21, 2021

I came here to report the same issue... the point is that some implementations of man (ie man-db, used by most distros) have a non-standard "-W" option, others (in my case, mandoc on voidlinux) do not.
Obvious fix: try man -w -W first and fall back to man -w if it fails, ie:

		snprintf(buf, sizeof(buf), "man -w -W %s %s", ManOptions, name);
		pathFile = popen(buf, "r");
		if (fgets(buf, sizeof(buf), pathFile)==NULL)
		{
				/* Try without -W */
				snprintf(buf, sizeof(buf), "man -w -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);

Should have no functional change as "-W" shows catpages which are no longer widespread afaik.
Tested ok on void/musl; @beginner3456789 ok for you?

@whitelynx
Copy link

I've run into this same issue on both NixOS and Void Linux. (it worked fine on Arch) I'm going to try building from source with this patch to see if it fixes it.

whitelynx added a commit to whitelynx/pinfo that referenced this issue Jun 9, 2024
@whitelynx whitelynx linked a pull request Jun 9, 2024 that will close this issue
@whitelynx
Copy link

@loreb your fix solves the issue for me. I opened a PR and tried to credit you for the change; please let me know if you'd prefer we handle it some other way. :)

PR: #36

@loreb
Copy link

loreb commented Jun 9, 2024

@whitelynx perfect, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants