Files
sed/doc/dummy-man
T
Jim Meyering d1d7eeafe4 build: work when perl is installed but not in /usr/bin/perl
Also support building on systems without perl and when cross-compiling.
* configure.ac (AC_ARG_ENABLE [bold-man-page-references]): New
configure-time option, using code copied from coreutils.
(BUILD_MAN_PAGE, BUILD_DUMMY_MAN_PAGE): Remove definitions.
(HAVE_PERL): Remove bogus conditional.
* doc/dummy-man: New file, from coreutils, with slight adapation.
* build-aux/help2man: Update from coreutils.
* doc/local.mk (EXTRA_DIST): Distribute dummy-man.
(run_help2man): New variable.
(doc/sed.1): Use it rather than simply invoking help2man.
Simplify to use only one copy of this rule, now that run_help2man
works both with and without perl and when cross-compiling.
Move the --name=... string argument into...
* doc/sed.x: ... here. Also make the "Synopsis" appear in generated file.
In https://lists.gnu.org/r/sed-devel/2022-10/msg00005.html,
Bruno Haible reported build failure with perl in a different
location and (in another report) another failure with no perl at all.
2022-10-16 22:13:11 -07:00

74 lines
1.7 KiB
Bash
Executable File

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