LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   bash line wrapping gone awol (https://www.linuxquestions.org/questions/linux-software-2/bash-line-wrapping-gone-awol-59456/)

acid_kewpie 05-12-2003 05:52 PM

bash line wrapping gone awol
 
ever since i installed gentoo i had a niggle about bash (i think it's bash... not really sure who's fault it is) where rather than formatting a manpage like http://thirtythreeandathird.net/goodman.png which happens if i ssh to my server and look at a man page, i get something like http://thirtythreeandathird.net/badman.png . From what i can gather the $COLUMNS variable is not being reported correctly inside a shell script or something in that vein as it happens with other scripts too, such as http://thirtythreeandathird.net/scrollbar from the bash examples scripts. Some *very* vaguely related threads on the net point a finger at readline, but that's not exactly my problem....

any ideas??

Tinkster 05-12-2003 05:57 PM

Gidday Chris!

Not sure where I'm getting this one from,
but all of a sudden terminal type (as in
vt100, vt102, ...) pops into my head ...

termcap, terminfo :)

Cheers,
Tink

bigrigdriver 05-12-2003 10:44 PM

I had the same problem a year ago. The problem/solution is in man itself (would you believe 'man man' for more info?). The command is something like 'man -c <command>' to reformat the display. Anyhow, try 'man man' or 'info man' for more info.

acid_kewpie 05-13-2003 12:10 PM

man pages were the best example i could think of, but it is in other areas too, on any shell, i'ev looked through the man pages and fiddled with -c, nada....

don't know if my post was cofusing tink, but it's the local terminal that is formatted badly, not the remote one...

Tinkster 05-13-2003 03:33 PM

I think I understood that Chris ...

what I meant is: what is your local terminal
identifying itself as?

eg ... if I telnet (yeah, I know, it's not my fault)
to one of our Dec unix hosts and do a man
it comes back to me telling me my terminal
of type linux is unknown and thus isn't fully
functional. When I locally start a xterm -ti linux&,
and do a man man, I get a horribly garbled output :)
and even reset won't clean up the mess...

Cheers,
Tink

david_ross 05-13-2003 04:23 PM

Running:
stty -a

Should tell you the terminal width. "man stty" talks about setting the number of columns but I have never needed to know that so I can't help much there.

acid_kewpie 05-13-2003 04:37 PM

hmm, ok i've been digging around an awful lot and i *think* i've traced it back to man itself, or more specifically groff version 1.18 which (maybe only on gentoo) ignores one of the man formatting commands, namely .ll which sets the line length. i'm not sure if this is gentoo specific or not, and i'd really appreciate it if someone 1) not on gentoo and 2) with groff 1.18 or 1.18.1 could confirm wether their manpages do get automatically resized to match the width of their terminal. thanks.

sorry if i confused you saying it wasn't just man as i was sure it wasn't. arse.

david_ross 05-13-2003 05:06 PM

A man page on my rh9 system with groff 1.18.1 wraps perfectly at column 78.

Hope this helps!

david_ross 05-13-2003 06:10 PM

OK - I've done some checking/playing with groff and I am able to change my default man width to 50 cols by using:
NROFF /usr/bin/nroff -c -mandoc -rLL=50n

instead of:
NROFF /usr/bin/nroff -c -mandoc

in my /etc/man.config.

Also after reading the groff man pages it looks like it should default to 78 cols if there is no override.

A simple grep:
grep -R "ll 78n" /usr/share/groff/*

Shows the following files hold the default values.
/usr/share/groff/1.18.1/tmac/an-old.tmac:. ie n .nr LL 78n
/usr/share/groff/1.18.1/tmac/an-old.tmac:. ie n .nr LT 78n
/usr/share/groff/1.18.1/tmac/doc-old.tmac:. nr ll 78n
/usr/share/groff/1.18.1/tmac/doc-old.tmac:. ll 78n
/usr/share/groff/1.18.1/tmac/doc-old.tmac:. nr lt 78n
/usr/share/groff/1.18.1/tmac/doc-old.tmac:. lt 78n
/usr/share/groff/1.18.1/tmac/mdoc/doc-nroff:.ll 78n
/usr/share/groff/1.18.1/tmac/mdoc/doc-nroff:.lt 78n
/usr/share/groff/1.18.1/tmac/mdoc/docj-nroff:.nr ll 78n
/usr/share/groff/1.18.1/tmac/mdoc/docj-nroff:.ll 78n
/usr/share/groff/1.18.1/tmac/mdoc/docj-nroff:.nr lt 78n
/usr/share/groff/1.18.1/tmac/mdoc/docj-nroff:.lt 78n

To change my man pages I can edit the LL line in:
/usr/share/groff/1.18.1/tmac/an-old.tmac

To the value I want to make the default (if you do this there is no need to edit /etc/man.config).

Hope that all makes sense - I have never done it before but from the tests I have carried out - it does work for me and hopefully you too ;)

acid_kewpie 05-14-2003 03:20 AM

interesting, i would be fairly confident that this is a bug of some sort, but can't for the life of me understrand how this hasn't been fixed if that is the case... it's surely not a deliberte thing...!? if you try downgrading to 1.17 (and removing the -c from the NROFF statement in man.conf) then you should find that your manpages perfectly fit the termainl, whatever the width of the window. there's no way AFAIK to make that default command depend on the width. man builds up a real long command line and just uses set values for nroff / groff... thanks for looking into it... it can be fun getting your hands dirty.

mhearn 05-14-2003 05:04 AM

Try this:

shopt -s checkwinsize

then resize the xterm and then run man again.


All times are GMT -5. The time now is 06:13 AM.