Short Attention Span Theatre

The man from HEAD

To paraphrase myself on freebsd-questions: "What an in­ter­est­ing night of ex­per­i­men­ta­tion." Most of this post has already been tubified on the mailing list, but I want to get down some details, and make sure I can easily find the in­for­ma­tion later.

A small irritation about FreeBSD is man does not au­to­mat­i­cal­ly adjust its line-length to account for the number of columns currently displayed in a particular xterm. So, after weeks of in­ter­mit­tent frus­tra­tion and small, aborted attempts to determine why I could not get the man to do what I wanted, I decided a concerted effort was worth my time (that, and I asked for help ;)).

My goal was to have man whatever au­to­mat­i­cal­ly adjust line-lenths based on the number of columns on the display device. Un­ex­pect­ed­ly, after the initial flurry of emails with in­for­ma­tion leading toward a solution, the fix was the work of a single night.

The first solution was the following shell script.

dave@heffalump:~$ cat bin/
mpage=`man -w $1`
tcols=`stty -a | grep columns | awk '{ print $6 }'`

zcat -f `man -w $1` | groff -Tutf8 -man -rIN=7n -rLL=`echo ${tcols} - 3 | bc`n - | less

The shell script above does the minimum - it adjusts the line-length of a given man page based on the number of columns being displayed. However, there were multiple problems.

Ok... maybe only one problem. Regardless, the lack of man -k was an irritant I would not suffer gladly.

Knowing man adjusted line-length based on columns on FreeBSD-CURRENT caused me to look at the difference between man in HEAD and 8.1-RELEASE, where I discovered the man from HEAD is a shell script! Woohoo! That inspired a second solution: Take the shell script from HEAD, and install it for my users use. That was not a complete solution, as apparently the behavior of man in HEAD (regarding line-length) was the result of an outside factor. However, man being a shell script meant I could modify, so I did the following.

Finally, my man pages are displayed in full-col-o-vision!

So, more gymnastics than I would like, but functional. I will use this method until the new shell script version in HEAD makes it into the base of a release I am running.

Thanks to all on the mailing list for the in­for­ma­tion and in­spi­ra­tion!

Local ports on FreeBSD » « Symantec LiveUpdate annoyance
sast favicon