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

fix the completion problem of `man` under OS X #960

Closed
wants to merge 2 commits into from

Conversation

@wwwjfy
Copy link
Contributor

@wwwjfy wwwjfy commented Aug 18, 2013

The problem is apropos under OS X behaves differently from Linux.

  1. The format: for command apropos sudo, the output under Linux:
sudo (8)             - execute a command as another user

and the output under OS X:

sudo(8)                  - execute a command as another user

one-space difference.

  1. For some items sharing a same manpage, e.g. for apropos printf,

Linux:

printf (3)           - formatted output conversion
snprintf (3)         - formatted output conversion
sprintf (3)          - formatted output conversion
vprintf (3)          - formatted output conversion
vsnprintf (3)        - formatted output conversion
vsprintf (3)         - formatted output conversion

OS X:

printf(3), fprintf(3), sprintf(3), snprintf(3), asprintf(3), dprintf(3), vprintf(3), vfprintf(3), vsprintf(3), vsnprintf(3), vasprintf(3), vdprintf(3) - formatted output conversion

OS X puts them in one line.

So, we need special handling here, otherwise, completion with prefix
man 3 printf will give the result of "man 3 printf(3),"

The problem is `apropos' under OS X behaves differently from Linux.

1. The format: for command `apropos sudo', the output under Linux:
...
sudo (8)             - execute a command as another user
...
and the output under OS X:
...
sudo(8)                  - execute a command as another user
...

one-space difference.

2. For some items sharing a same manpage, e.g. for `apropos printf',
Linux:
...
printf (3)           - formatted output conversion
snprintf (3)         - formatted output conversion
sprintf (3)          - formatted output conversion
vprintf (3)          - formatted output conversion
vsnprintf (3)        - formatted output conversion
vsprintf (3)         - formatted output conversion
...
OS X:
...
printf(3), fprintf(3), sprintf(3), snprintf(3), asprintf(3), dprintf(3), vprintf(3), vfprintf(3), vsprintf(3), vsnprintf(3), vasprintf(3), vdprintf(3) - formatted output conversion
...

OS X puts them in one line.

So, we need special handling here, otherwise, completion with prefix
`man 3 printf' will give the result of "man 3 printf\(3\),"
@zanchey
Copy link
Member

@zanchey zanchey commented Aug 19, 2013

The behaviour of apropos on FreeBSD mirrors that of Darwin (unsurprisingly), so detecting uname is probably the wrong thing to do here.

@wwwjfy
Copy link
Contributor Author

@wwwjfy wwwjfy commented Aug 19, 2013

@zanchey Oh, I was not aware of that. I don't have FreeBSD, so I don't know how to tell the differences.
What about

  1. use uname for Linux and others. I doubt it's a good option.
  2. include FreeBSD's uname value into Darwin. No idea about all the options, are they only FreeBSD-ish or LInux-ish?
@zanchey
Copy link
Member

@zanchey zanchey commented Aug 19, 2013

It gets worse! Solaris uses a totally different format altogether!

fwprintf        fwprintf (3c)   - print formatted wide-character output
printf          printf (1)      - write formatted output
printf          printf (3c)     - print formatted output
@wwwjfy
Copy link
Contributor Author

@wwwjfy wwwjfy commented Aug 19, 2013

@zanchey So we need another case? I think it'll be difficult to get an all-in-one command

@zanchey
Copy link
Member

@zanchey zanchey commented Nov 22, 2013

I have a solution using awk, but I'm honestly not sure if we care about Solaris any more. Current fish head doesn't build on Solaris, /usr/bin/awk is different to all other OSes that we support...

@wwwjfy
Copy link
Contributor Author

@wwwjfy wwwjfy commented Nov 23, 2013

In my opinion, it's not a problem to improve step by step. If anyone uses Solaris is uncomfortable with it, he can issue a pull request.

@zanchey zanchey closed this in 0c4dab5 Nov 27, 2013
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.