howto access man and info pages?
is there some lib or something out there that can access man or info pages?, i need to be able to get a program to search thru these pages from a single program, so i don't have to keep using "man" and "info" trying to see what one contains what i want to know
|
Why not just use the program directly and pipe the info to where you need it?
man itself doesn't work as one program. Man pages are uncompressed with gzip formatted with nroff and piped through to a pager. Example here: http://64.233.161.104/search?q=cache...ipe+exec&hl=en |
Yes. man pages and info pages are basically normal ascii files (with some groff/texi tags for formatting), often gzipped.. For the man pages you can find out where they are on the system with:
Code:
popen("manpath", "r"); |
so i should be able to read both man and info pages by using groff to give me human readable output?
|
Quote:
Anyways it's easier to use the "man" or "info" themselves. When you redirect (man ls >file.txt) or pipe (man ls | cat) "man" as well as "info" will output as human-readable text (ascii), with formatting tags removed. A small drawback is that you will also lose the bold/italic attributes: it will be plain ascii. To do this from a program (assuming your are using the C language, please mention your programming language the next time), you can read the man/info pages into your program when you execute "man" or "info" with the popen() function. Popen() will fork() the man/info command and open a pipe to your program from which you can read the output. I've written a complete program to demonstrate (I think I may need this myself one day, so..). I hope you can use this as well. Code:
#include <stdio.h> Bug: I noticed that the program does not detect correctly the exit status of man and info. So it does not report (as you would expect when reading my code) if the document is not found. </edit> |
thanks, that helps me out a lot
|
All times are GMT -5. The time now is 06:43 AM. |