I'm looking for a way to query the linux man pages through an API, the closest I've found is http://linux.die.net/man, however there the commands are split into 8 sections, e.g. gcc is in section 1: http://linux.die.net/man/1/gcc, and as it's not actually an API so you get a full html page (sidebar and ads included) in return.
Before I plough on and try to make one, does something like this already exist?
Why not just use your local man pages? Man pages are just compressed text files of nroff source code. nroff is confusing and weird, but should be doable. A man page creation guide should make it clear.
For the location of the files, use man -w COMMAND
. On my machine man -w man
gives me /usr/share/man/man1/man.1.gz
. So my man files are stored in the subdirectories of /usr/share/man
. Probably would be easy to index from there.
If you look hard enough, someone probably already wrote a man page parser.