From owner-freebsd-questions@FreeBSD.ORG Thu Jan 20 04:51:49 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB13F106564A for ; Thu, 20 Jan 2011 04:51:48 +0000 (UTC) (envelope-from dave-lists-freebsd-questions@weller-fahy.com) Received: from tigger.weller-fahy.com (sinecure.xen.prgmr.com [64.71.167.144]) by mx1.freebsd.org (Postfix) with ESMTP id D1BCE8FC13 for ; Thu, 20 Jan 2011 04:51:47 +0000 (UTC) Received: (qmail 18831 invoked from network); 19 Jan 2011 20:54:06 -0800 Received: from unknown (HELO weller-fahy.com) (dave@weller-fahy.com@70.250.75.158) by tigger.weller-fahy.com with AES256-SHA encrypted SMTP; 19 Jan 2011 20:54:06 -0800 Date: Wed, 19 Jan 2011 22:51:45 -0600 From: "David J. Weller-Fahy" To: freebsd-questions@freebsd.org Message-ID: <20110120045145.GL90952@weller-fahy.com> Mail-Followup-To: freebsd-questions@freebsd.org References: <20110118034037.GF90952@weller-fahy.com> <20110118182918.GA14251@Grumpy.DynDNS.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="liqSWPDvh3eyfZ9k" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: How to adjust man page line length [SOLVED] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jan 2011 04:51:49 -0000 --liqSWPDvh3eyfZ9k Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Giorgos Keramidas [2011-01-19 02:57 -0500]: > On Tue, 18 Jan 2011 12:29:18 -0600, David Kelly wrote: > > On Tue, Jan 18, 2011 at 06:11:13PM +0100, Giorgos Keramidas wrote: > >> Set the 'columns' attribute of your tty: > >> stty columns 60 > >> man xxx > > > > *Should*? You posted without trying it? (I tried, did not work). >=20 > 'Should' as in "I tried it here and it worked". I'm running a recent > CURRENT snapshot, but I don't think this affects the results. What > does 'stty -a' show in your terminal? What is your shell's > environment (e.g. the value of COLUMNS)? What is your PAGER? etc. Well... that was an interesting night of experimentation. Thanks for the idea about stty (which I didn't know about), because otherwise I might have gone mad (apparently COLUMNS isn't set in the environment of a shell script... which makes sense when one thinks about it). Regardless, I ended up finding two solutions. First, I created the following shell script. #v+ dave@heffalump:~$ cat bin/man.sh #!/bin/sh mpage=3D`man -w $1` tcols=3D`stty -a | grep columns | awk '{ print $6 }'` zcat -f `man -w $1` | groff -Tutf8 -man -rIN=3D7n -rLL=3D`echo ${tcols} - 3= | bc`n - | less #v- That did the job, but made `man -k`, which my fingers find familiar, unusable. I remembered you were running a CURRENT snapshot, so figured I'd check the difference between man in HEAD and 8.1-RELEASE... WOW! The man in HEAD is now a shell script. That inspired a second solution: Take the shell script from HEAD, and install it for my user's use. So, I checked out the man from HEAD. svn checkout svn://svn.freebsd.org/base/head/usr.bin/man I installed fakeroot (needed to install the man pages). The Makefile doesn't honor PREFIX, but does honor BINDIR/MANDIR, so I used the following command-line to install the man from HEAD. fakeroot make install BINDIR=3D/home/dave/usr/bin MANDIR=3D/home/dave/usr/= man/man NO_MANCOMPRESS=3D"YES" Whoops! The program and man pages installed, but man pages were not displayed using the number of columns. Apparently there's more to the modified behavior in HEAD than just the man display program... but the new man is a shell script so I can modify it. I applied the following patch. #v+ --- man.sh.orig 2011-01-19 22:41:34.000000000 -0600 +++ man.sh 2011-01-19 22:41:33.000000000 -0600 @@ -891,9 +891,10 @@ search_whatis whatis "$@" } =20 +cols=3D`stty -a | grep columns | awk '{ print $6 }'` EQN=3D/usr/bin/eqn COL=3D/usr/bin/col -NROFF=3D'/usr/bin/groff -S -Wall -mtty-char -man' +NROFF=3D'/usr/bin/groff -S -Wall -mtty-char -man -rLL=3D`echo $cols - 3 | = bc`n' PIC=3D/usr/bin/pic SYSCTL=3D/sbin/sysctl TBL=3D/usr/bin/tbl #v- I installed again, and done! So, more gymnastics than I would like, but now man uses the current number of columns. I'll use this method until the new shell script version in HEAD makes it into the base of a release I'm running. Thanks to all for the information and inspiration! Regards, --=20 dave [ please don't CC me ] --liqSWPDvh3eyfZ9k Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) iEYEARECAAYFAk03v2AACgkQzahokXOb2UyryACdGv8XQ8Yichmg5A6BrwxGZ5GO FrAAn18zTY8pejB4ICOK/8oJZNVT8Y6g =p2Zf -----END PGP SIGNATURE----- --liqSWPDvh3eyfZ9k--