diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2013-12-15 01:39:56 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2013-12-15 01:39:56 +0100 |
commit | 929ba17dafd21ffe30ae7610c481e9d6fe306a5d (patch) | |
tree | 27784498a7b57dad795ec53472c8b63cd7d43c0a /Util | |
parent | 9cbb2a6e5f22298bc12f08d75962f53d1feb4ab6 (diff) | |
parent | b0d29667d32120019a1f333266539dcd136f659b (diff) | |
download | zsh-929ba17dafd21ffe30ae7610c481e9d6fe306a5d.tar.gz zsh-929ba17dafd21ffe30ae7610c481e9d6fe306a5d.zip |
New upstream release
Diffstat (limited to 'Util')
-rwxr-xr-x | Util/helpfiles | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/Util/helpfiles b/Util/helpfiles index ebd8bd125..900564842 100755 --- a/Util/helpfiles +++ b/Util/helpfiles @@ -65,13 +65,40 @@ $ENV{'LANG'} = 'C'; $ENV{'MANWIDTH'} = '80'; $ENV{'GROFF_NO_SGR'} = ''; # We need "classical" formatting of man pages. -unless(open(MANPAGE, '-|', "man $manfile | colcrt -")) { - close(MANPAGE); - open(MANPAGE, '-|', "man $manfile | col -bx") +$mantmp = $destdir . '/man.tmp'; +$coltmpbase = 'col.tmp'; +$coltmp = $destdir . '/' . $coltmpbase; +$args = "$manfile >$mantmp"; +unlink($mantmp); +&Info('attempting man ', $args); +if(system('man ' . $args) || !(-s $mantmp)) { + unlink($mantmp); + &Info('attempting nroff -man ', $args); + if(system('nroff -man ' . $args) || !(-s $mantmp)) { + unlink($mantmp); + &Die('man and nroff -man both failed for ', $manfile); + } +} +$args = "$mantmp >$coltmp"; +unlink($coltmp); +&Info('attempting colcrt ', $args); +if(system('colcrt ' . $args) || !(-s $coltmp)) { + unlink($coltmp); + &Info('attempting col -bx <', $args); # The x is necessary so that spaces don't turn into tabs, which messes # up the calculations of indentation on machines which randomly wrap lines # round to the previous line (so you see what we're up against). - || &Die('can run neither "man | colcrt -" nor "man | col -bx"'); + if(system('col -bx <' . $args) || !(-s $coltmp)) { + unlink($mantmp); + unlink($coltmp); + &Die('colcrt and col -bx both failed'); + } +} +unlink($mantmp) || &Die('cannot remove tempfile ', $mantmp); + +unless(open(MANPAGE, '<', $coltmp)) { + unlink($coltmp); + &Die('generated tmpfile cannot be read'); } unless($linkfile eq '') { @@ -198,7 +225,8 @@ BUILTINS: while (<MANPAGE>) { select STDOUT; close OUT; -close(MANPAGE) || &Die('piping from man ', $manfile, ' failed'); +close(MANPAGE); +unlink($coltmpbase) || &Die('cannot remove tempfile ', $coltmpbase); foreach $file (<*>) { open (IN, $file); |