popen(man XX | col -b)
I made a simple gtk man page viewer that uses popen("man [page] | col-b", "r").
Most of the time it works fine but I've begun to notice that there are a number (maybe one in ten) of pages that return "No manual page for [page]" even tho the other pages in the same path are found, and the exact same command on the command line works fine.
Perhaps this is not exactly a code problem but I don't know who/where else to ask...
ps (later): i was so ticked off about this I actually removed my man rpm and build "man-db" (which is also supposedly faster) from source -- but it does the same thing
Is your cwd getting changed at some point? Or is a path variable being overwritten somehow? I mean there isn't much outside of your code that can cause these sorts of issues. man and man-db are both well documented and well tested.
Why would the cwd matter? I know env variables are in the stack but they are not being overwritten -- I actually tested the "state of the path" by inserting:
Originally Posted by master5001
before the popen call. All looked well.
As for man and man-db being well documented & tested, I agree, but I have noticed some clumsy things about man that I sort of assumed were due to redhat (which they may have been, since man-db cleared those up, so it's not been a total loss). And, actually, man-db installs from source without creating a user for man, so when you go to create the database it gives an error. This problem is not diagnosed in their docs but is simple enough to correct if you know enough yourself already. They may have left it that way because it presents some security risk, in the hopes that distro packagers will take care of it. But I think some users could be up a tree, at least for a while.
So if that level of oversight is acceptable, why would you think everything else is flawless?
[update] after all that it turned out to be my mistake. But if you want to do some playtesting anyway: