diff options
| author | Philip Paeps <philip@FreeBSD.org> | 2022-08-16 08:09:47 +0000 |
|---|---|---|
| committer | Philip Paeps <philip@FreeBSD.org> | 2022-08-16 08:09:47 +0000 |
| commit | a24d752d3e77a28c877a5319face8d00aa1b558c (patch) | |
| tree | 5ae147d3bedd850833ec5c783ea54fa4b00e6aba /workman.sh | |
| parent | 9b5369d383baf54651be0922591eeb6263ce029d (diff) | |
Import tzcode 2022cvendor/tzcode/tzcode2022c
Diffstat (limited to 'workman.sh')
| -rw-r--r-- | workman.sh | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/workman.sh b/workman.sh index 2fbb7e211c6c..6e2da3a80c8d 100644 --- a/workman.sh +++ b/workman.sh @@ -1,20 +1,23 @@ #! /bin/sh +# Convert manual page troff stdin to formatted .txt stdout. -# <pre> -# @(#)workman.sh 8.2 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. -# Tell groff not to emit SGR escape sequences (ANSI color escapes). -GROFF_NO_SGR=1 -export GROFF_NO_SGR +if (type nroff && type perl) >/dev/null 2>&1; then -echo ".am TH + # Tell groff not to emit SGR escape sequences (ANSI color escapes). + GROFF_NO_SGR=1 + export GROFF_NO_SGR + + echo ".am TH .hy 0 .na .. .rm }H .rm }F" | nroff -man - ${1+"$@"} | perl -ne ' + binmode STDIN, '\'':encoding(utf8)'\''; + binmode STDOUT, '\'':encoding(utf8)'\''; chomp; s/.\010//g; s/\s*$//; @@ -29,4 +32,10 @@ echo ".am TH print "$_\n"; $didprint = 1; } -' + ' +elif (type mandoc && type col) >/dev/null 2>&1; then + mandoc -man -T ascii "$@" | col -bx +else + echo >&2 "$0: please install nroff and perl, or mandoc and col" + exit 1 +fi |
