summaryrefslogtreecommitdiff
path: root/doc/mkposix
blob: ff4db1fcb764aba7c6cb17ccbba619bbe994b6a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/sh
#
# mkposix - make the POSIX.NOTES file from the `Bash POSIX Mode' node
#	    of the texinfo manual
#

# defaults for doing this in the source tree
SRCDIR=.
TOPDIR=..

NODE="Bash POSIX Mode"
TEXI=bashref.texi
TMPINFO=temp.info
TMPOUT=POSIX.tmp

prog=${0##*/}
USAGE="usage: $prog [-s srcdir] [-t topdir] [output-file]"
while getopts s:t: opt
do
	case "$opt" in
	s)	SRCDIR=$OPTARG TEXI=${OPTARG}/bashref.texi ;;
	t)	TOPDIR=$OPTARG ;;
	*)	echo "$USAGE" >&2 ; exit 2 ;;
	esac
done
shift $(( $OPTIND - 1 ))

OUT=${1:-POSIX}

trap 'rm -f $TMPOUT $TMPINFO $OUT; trap '' 0; exit 1' 1 2 3 6 15
trap 'rm -f $TMPOUT $TMPINFO' 0

# create an info file without paragraph indentation
RLDIR=${TOPDIR}/lib/readline/doc
makeinfo --no-split -I${RLDIR} --paragraph-indent 0 -o $TMPINFO $TEXI

# write out the text from the `Bash POSIX Mode' node to $TMPOUT
info --file $TMPINFO --node "$NODE" --subnodes --output $TMPOUT

sed 1,2d < $TMPOUT > $OUT

exit 0