nroff - help wanted
John Quarterman
jsq at ut-sally.UUCP
Mon Jul 2 13:11:20 AEST 1984
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 at ut-sally.ARPA, jsq at ut-sally.UUCP, {ihnp4,seismo,ctvax}!ut-sally!jsq
More information about the Comp.unix.wizards
mailing list