Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix the completion problem of man under OS X#960

Closed
wwwjfy wants to merge 2 commits into
fish-shell:masterfish-shell/fish-shell:masterfrom
wwwjfy:osx-man-completion-fixwwwjfy/fish-shell:osx-man-completion-fixCopy head branch name to clipboard
Closed

fix the completion problem of man under OS X#960
wwwjfy wants to merge 2 commits into
fish-shell:masterfish-shell/fish-shell:masterfrom
wwwjfy:osx-man-completion-fixwwwjfy/fish-shell:osx-man-completion-fixCopy head branch name to clipboard

Conversation

@wwwjfy

@wwwjfy wwwjfy commented Aug 18, 2013

Copy link
Copy Markdown
Contributor

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

zanchey commented Aug 19, 2013

Copy link
Copy Markdown
Member

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

@wwwjfy

wwwjfy commented Aug 19, 2013

Copy link
Copy Markdown
Contributor Author

@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

zanchey commented Aug 19, 2013

Copy link
Copy Markdown
Member

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

wwwjfy commented Aug 19, 2013

Copy link
Copy Markdown
Contributor Author

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

@zanchey

zanchey commented Nov 22, 2013

Copy link
Copy Markdown
Member

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

wwwjfy commented Nov 23, 2013

Copy link
Copy Markdown
Contributor Author

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.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.