0

Is there a way to find a man page given a Standard-C-type or POSIX-type? Such as man size_t or man uintptr_t. This kind of thing can get confusing because uintptr_t is defined in stdint.h, and size_t is defined in stddef.h. I have the docs for both stdint.h and stddef.h installed (via manpages-posix-dev), and I can for example run man stddef.h if I know the header name?

This is specifically about types, I want to find the man pages for the type -- the header they're defined in.

  • @ThomasDickey that question is closed for being too broad, and afaik none of those suggestions work, if you have any advice please submit an answer. Why would you think that's a dupe? – Evan Carroll Jul 7 '18 at 21:48
  • I closed it as a dup b/c my solution w/ others were present on that, so your question will do little more than elicit more of the same A'ers, IMO. It's a interesting Q though, I'm trying to think of how to scope it so that it doesn't turn into a dumping ground of "maybe" A'ers 8-). – slm Jul 7 '18 at 21:52
  • @slm that question is too vague though -- this one is not, I don't think we should be closing questions ontop of crap, but it's your call -- I think you're answer is a great contribution. Perhaps you should close that one to this one so we have a well defined question with a solid chosen answer? – Evan Carroll Jul 7 '18 at 21:56
  • Also, while I'm arguing it's not a dupe and while your answer does work and I have chosen it, I would still accept a better answer if any other cprogrammers have a more a clever solution for navigating the docs here. – Evan Carroll Jul 7 '18 at 21:59
1

man -K <string> Capital K is the closest thing I've seen to being able to do this using man.

-K, --global-apropos Search for text in all manual pages. This is a brute-force search, and is likely to take some time; if you can, you should specify a section to reduce the number of pages that need to be searched. Search terms may be simple strings (the default), or regular expressions if the --regex option is used.

Note that this searches the sources of the manual pages, not the rendered text, and so may include false positives due to things like comments in source files. Searching the rendered text would be much slower.

$ man -K "Hello World"

Note you can use -I for a case-sensitive match which is substantially faster. When run, man will open the first match,and after you close it with q, offer you to:

  • view the next one (Return)
  • skip the current one (Ctrl+D)
  • or exit (Ctrl+C).

References

  • But that doesn't work for either of these, I did try that before asking though =) uintptr_t: nothing appropriate. size_t: nothing appropriate. – Evan Carroll Jul 7 '18 at 21:46
  • Odd, I just did it on a CentOS 7.x VM and it resulted in hits. – slm Jul 7 '18 at 21:48
  • Not sure what to say, I'll update the question with the example. – Evan Carroll Jul 7 '18 at 21:49
  • This is the output after the first resulting page being shown, and me hitting q: man -K "size_t" --Man-- next: ld(1) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]. – slm Jul 7 '18 at 21:50
  • That works, man -K. Nice #TIL. – Evan Carroll Jul 7 '18 at 21:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.