|
Packit Service |
2723c6 |
#!/bin/sh
|
|
Packit Service |
2723c6 |
# Poor man's placeholder for help2man invocation on systems lacking perl,
|
|
Packit Service |
2723c6 |
# or when cross compiling.
|
|
Packit Service |
2723c6 |
# It just copies the distributed man pages.
|
|
Packit Service |
2723c6 |
|
|
Packit Service |
2723c6 |
set -e; set -u
|
|
Packit Service |
2723c6 |
|
|
Packit Service |
2723c6 |
fatal_ ()
|
|
Packit Service |
2723c6 |
{
|
|
Packit Service |
2723c6 |
printf '%s: %s\n' "$0" "$*" >&2
|
|
Packit Service |
2723c6 |
exit 1
|
|
Packit Service |
2723c6 |
}
|
|
Packit Service |
2723c6 |
|
|
Packit Service |
2723c6 |
basename_ ()
|
|
Packit Service |
2723c6 |
{
|
|
Packit Service |
2723c6 |
printf '%s\n' "$1" | sed 's,.*/,,'
|
|
Packit Service |
2723c6 |
}
|
|
Packit Service |
2723c6 |
|
|
Packit Service |
2723c6 |
output=
|
|
Packit Service |
2723c6 |
source="GNU coreutils"
|
|
Packit Service |
2723c6 |
while test $# -gt 0; do
|
|
Packit Service |
2723c6 |
case $1 in
|
|
Packit Service |
2723c6 |
# Help2man options we recognize and handle.
|
|
Packit Service |
2723c6 |
--output=*) output=`expr x"$1" : x'--output=\(.*\)'`;;
|
|
Packit Service |
2723c6 |
--output) shift; output=$1;;
|
|
Packit Service |
2723c6 |
--include=*) include=`expr x"$1" : x'--include=\(.*\)'`;;
|
|
Packit Service |
2723c6 |
--include) shift; include=$1;;
|
|
Packit Service |
2723c6 |
--source=*) source=`expr x"$1" : x'--source=\(.*\)'`;;
|
|
Packit Service |
2723c6 |
--source) shift; source=$1;;
|
|
Packit Service |
2723c6 |
# Recognize (as no-op) other help2man options that might be used
|
|
Packit Service |
2723c6 |
# in the makefile.
|
|
Packit Service |
2723c6 |
--info-page=*);;
|
|
Packit Service |
2723c6 |
-*) fatal_ "invalid or unrecognized help2man option '$1'";;
|
|
Packit Service |
2723c6 |
--) shift; break;;
|
|
Packit Service |
2723c6 |
*) break;;
|
|
Packit Service |
2723c6 |
esac
|
|
Packit Service |
2723c6 |
shift
|
|
Packit Service |
2723c6 |
done
|
|
Packit Service |
2723c6 |
|
|
Packit Service |
2723c6 |
test $# -gt 0 || fatal_ "missing argument"
|
|
Packit Service |
2723c6 |
test $# -le 1 || fatal_ "too many non-option arguments"
|
|
Packit Service |
2723c6 |
|
|
Packit Service |
2723c6 |
dist_man=$(printf '%s\n' "$include" | sed 's/\.x$/.1/')
|
|
Packit Service |
2723c6 |
test -f "$dist_man" && cp "$dist_man" "$output" && exit || :
|
|
Packit Service |
2723c6 |
|
|
Packit Service |
2723c6 |
baseout=`basename_ "$output"`
|
|
Packit Service |
2723c6 |
sed 's/^/WARNING: /' >&2 <
|
|
Packit Service |
2723c6 |
Did not generate or find default '$baseout' man page.
|
|
Packit Service |
2723c6 |
Creating a stub man page instead.
|
|
Packit Service |
2723c6 |
END
|
|
Packit Service |
2723c6 |
|
|
Packit Service |
2723c6 |
progname=`basename_ "$1"`
|
|
Packit Service |
2723c6 |
bs='\'
|
|
Packit Service |
2723c6 |
|
|
Packit Service |
2723c6 |
cat >"$output" <
|
|
Packit Service |
2723c6 |
.TH "$progname" 1 "$source" "User Commands"
|
|
Packit Service |
2723c6 |
.SH NAME
|
|
Packit Service |
2723c6 |
$progname $bs- a $source program
|
|
Packit Service |
2723c6 |
.SH DESCRIPTION
|
|
Packit Service |
2723c6 |
.B OOPS!
|
|
Packit Service |
2723c6 |
We were unable to create a proper manual page for
|
|
Packit Service |
2723c6 |
.B $progname.
|
|
Packit Service |
2723c6 |
For concise option descriptions, run
|
|
Packit Service |
2723c6 |
.IP
|
|
Packit Service |
2723c6 |
.B env $progname --help
|
|
Packit Service |
2723c6 |
.PP
|
|
Packit Service |
2723c6 |
The full documentation for
|
|
Packit Service |
2723c6 |
.B $progname
|
|
Packit Service |
2723c6 |
is maintained as a Texinfo manual, which should be accessible
|
|
Packit Service |
2723c6 |
on your system via the command
|
|
Packit Service |
2723c6 |
.IP
|
|
Packit Service |
2723c6 |
.B info $bs(aq(coreutils) $progname invocation$bs(aq
|
|
Packit Service |
2723c6 |
END
|