#!/bin/sh
prg="$1"
shift
# mandoc passes a file name, other tools write to stdout
# using `cat "$@"` we take care of both reading from file and stdin
exec cat "$@" | col -bx | $prg --language man --style plain