2 # Poor man's placeholder for help2man invocation on systems lacking perl,
3 # or when cross compiling.
4 # It just copies the distributed man pages.
10 printf '%s: %s\n' "$0" "$*" >&2
16 printf '%s\n' "$1" |
sed 's,.*/,,'
20 source="GNU coreutils"
21 while test $# -gt 0; do
23 # Help2man options we recognize and handle.
24 --output=*) output
=`expr x"$1" : x'--output=\(.*\)'`;;
25 --output) shift; output
=$1;;
26 --include=*) include
=`expr x"$1" : x'--include=\(.*\)'`;;
27 --include) shift; include
=$1;;
28 --source=*) source=`expr x"$1" : x'--source=\(.*\)'`;;
29 --source) shift; source=$1;;
30 # Recognize (as no-op) other help2man options that might be used
33 -*) fatal_
"invalid or unrecognized help2man option '$1'";;
40 test $# -gt 0 || fatal_
"missing argument"
41 test $# -le 1 || fatal_
"too many non-option arguments"
43 dist_man
=$
(printf '%s\n' "$include" |
sed 's/\.x$/.1/')
44 test -f "$dist_man" && cp "$dist_man" "$output" && exit ||
:
46 baseout
=`basename_ "$output"`
47 sed 's/^/WARNING: /' >&2 <<END
48 Did not generate or find default '$baseout' man page.
49 Creating a stub man page instead.
52 progname
=`basename_ "$1"`
56 .TH "$progname" 1 "$source" "User Commands"
58 $progname $bs- a $source program
61 We were unable to create a proper manual page for
63 For concise option descriptions, run
65 .B env $progname --help
67 The full documentation for
69 is maintained as a Texinfo manual, which should be accessible
70 on your system via the command
72 .B info $bs(aq(coreutils) $progname invocation$bs(aq