Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ut-sally.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!ut-sally!jsq From: jsq@ut-sally.UUCP (John Quarterman) Newsgroups: net.unix-wizards Subject: Re: nroff - help wanted Message-ID: <2450@ut-sally.UUCP> Date: Sun, 1-Jul-84 23:11:20 EDT Article-I.D.: ut-sally.2450 Posted: Sun Jul 1 23:11:20 1984 Date-Received: Tue, 3-Jul-84 03:40:36 EDT References: <407@kvvax4.UUCP> <400005@bradley.UUCP> <125@hwcs.UUCP> Organization: U. Texas CS Dept., Austin, Texas Lines: 28 Not terribly fast, but easy to do and requires no nroff changes: #!/bin/awk -f # A filter, ff, to insert form feeds at page boundaries in nroff output # and possibly to shorten the pages at the same time. BEGIN { nroffpage = 66; # the usual default nroff page length printpage = 63; # the shortest printer page I've run across if (printpage > nroffpage) { trimtop = 0; trimend = nroffpage; } else { totrim = nroffpage - printpage; trimtop = sprintf ("%d", totrim / 2 + .5); trimend = nroffpage - (totrim - trimtop); } count = 0; } { if (++count == nroffpage) { count = 0; printf (" "); # a form feed, ASCII 014 or 0x0C, control L } else if (count > trimtop && count < trimend) print $0; } -- John Quarterman, CS Dept., University of Texas, Austin, Texas 78712 USA jsq@ut-sally.ARPA, jsq@ut-sally.UUCP, {ihnp4,seismo,ctvax}!ut-sally!jsq