VirtualBox

source: kBuild/trunk/src/sed/doc/dummy-man@ 3613

Last change on this file since 3613 was 3613, checked in by bird, 7 months ago

src/sed: Merged in changes between 4.1.5 and 4.9 from the vendor branch. (svn merge /vendor/sed/4.1.5 /vendor/sed/current .)

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#!/bin/sh
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.
5
6set -e; set -u
7
8fatal_ ()
9{
10 printf '%s: %s\n' "$0" "$*" >&2
11 exit 1
12}
13
14basename_ ()
15{
16 printf '%s\n' "$1" | sed 's,.*/,,'
17}
18
19output=
20source="GNU sed"
21while test $# -gt 0; do
22 case $1 in
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
31 # in the makefile.
32 --info-page=*);;
33 -*) fatal_ "invalid or unrecognized help2man option '$1'";;
34 --) shift; break;;
35 *) break;;
36 esac
37 shift
38done
39
40test $# -gt 0 || fatal_ "missing argument"
41test $# -le 1 || fatal_ "too many non-option arguments"
42
43dist_man=$(printf '%s\n' "$include" | sed 's/\.x$/.1/')
44test -f "$dist_man" && cp "$dist_man" "$output" && exit || :
45
46baseout=`basename_ "$output"`
47sed 's/^/WARNING: /' >&2 <<END
48Did not generate or find default '$baseout' man page.
49Creating a stub man page instead.
50END
51
52progname=`basename_ "$1"`
53bs='\'
54
55cat >"$output" <<END
56.TH "$progname" 1 "$source" "User Commands"
57.SH NAME
58$progname $bs- stream editor for filtering and transforming text
59.SH DESCRIPTION
60.B OOPS!
61We were unable to create a proper manual page for
62.B $progname.
63For concise option descriptions, run
64.IP
65.B env $progname --help
66.PP
67The full documentation for
68.B $progname
69is maintained as a Texinfo manual, which should be accessible
70on your system via the command
71.IP
72.B info sed invoking
73END
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette