Can't view man pages with Bwana 2.4

Any trouble you encounter with the Pedias, here's the place to ask for help.
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: Can't view man pages with Bwana 2.4

Post by Conor »

Previously I setup my terminal to be able to display Chinese. But I don't remember how I did it.
Very interesting. What was the string, just gibirish? Not sure how to tell the terminal that Bwana needs the results in English, very strange that a file path would be translated. Do try running "man -w ls" in your terminal and seeing the results as that is what Bwana would run.
billyw
Contributor
Contributor
Posts: 6
Joined: Tue Apr 08, 2008 10:59 pm

Re: Can't view man pages with Bwana 2.4

Post by billyw »

I kind of figure out what the problem is in my system. Have you guys ever used fortune before, which is a small text program used to display a piece of words when you open the terminal. In order to enable fortune every time you login to a shell, you need to invoke fortune from .bashrc or .profile assuming you are using bash.

The problem when using Bwana and enable fortune at the same time is that the path returned in Bwana will be the words displayed by fortune instead of the truely manpath you want.

I guess Cisko encountered the same problem with me. If so, just tried commented it out fortune from bash.

Can I change the "-lc" in line 732 and 736 to "-c" instead?
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: Can't view man pages with Bwana 2.4

Post by Conor »

I never used fortune on my system, but I seen it running when logging in to large main frames. You can re-compile Bwana and create your own version as you like, by removing the -l option (it won't pick up manpaths declared in the .profile file). Tetsuro Kurita added that whole section in order to load local user variables. My original command when directly to /usr/bin/man (you can see my version lines commented out in). With the previous version of Bwana you had to add additional manpaths to the man.conf directly and not as an environment variable. Version 2.3 was working for you as there was no shell command involved. If your going to remove the -l option you might as well go directly for the old version and comment out bash and uncomment the /usr/bin/man. Thank you for all the information, it's good to know that issue exists in case other users have fortune installed.
billyw
Contributor
Contributor
Posts: 6
Joined: Tue Apr 08, 2008 10:59 pm

Re: Can't view man pages with Bwana 2.4

Post by billyw »

Thanks for you comments, Conor.

Suppose the shell will do something output during it starts. The manual page we really want is actually the last line in the string, where lines are separated by "\n".

Then how about to make the following change starting from line 749:

NSString *pathToManual = nil;
NSData *dataRecieved = [findPathHandle readDataToEndOfFile];
if ([dataRecieved length]) {
NSString *shellReturn = [[[NSString alloc] initWithData:dataRecieved encoding:NSASCIIStringEncoding] autorelease];

//remove EOF
shellReturn = [shellReturn substringToIndex:[shellReturn length] -1];

NSArray *cmdLines = [shellReturn componentsSeparatedByString: @"\n"];
pathToManual = [cmdLines lastObject];

The above will assign the last line to pathToManual. It works for me. And I think it is needed not only for the case of "fortune", since there might be other output when starting the shell, such as the legal notice when using the school machine, system message, etc.
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: Can't view man pages with Bwana 2.4

Post by Conor »

Thank you for the fix. I have added those two lines to get just the last line of the output. I also added billyw as the contributor, if you would like to be credited differently let me know.
Post Reply