No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / man / x-to-1.in
blobba465ddc197a9a9dfd70cad3808e6bf2d34e0d87
1 #! /bin/sh
3 # Copyright (C) 2001, 2003 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 # This program creates a program's manual from the .x skeleton and its --help
21 # output.
23 update=
24 while true; do
25 case "$1" in
26 --update) update=yes; shift;;
27 *) break;;
28 esac
29 done
31 if test $# != 5; then
32 echo "Usage: x-to-1 [OPTIONS] PERL HELP2MAN executable program.x program.1" 1>&2
33 exit 1
35 PERL="$1"
36 HELP2MAN="$2"
37 executable="$3"
38 aux="$4"
39 output="$5"
41 progname=`basename $aux .x`
42 case "$PERL" in *"/missing perl") perlok=no;; *) perlok=yes;; esac
43 if test @CROSS_COMPILING@ = no && test -f $executable && test $perlok = yes; then
44 echo "Updating man page $output"
45 echo "$HELP2MAN --include=$aux $executable > $output"
46 rm -f t-$progname.1
47 $HELP2MAN --include=$aux $executable > t-$progname.1 || exit 1
48 if test -n "$update"; then
49 # In --update mode, don't overwrite the output if nothing would change.
50 if cmp t-$progname.1 $output >/dev/null 2>&1; then
51 rm -f t-$progname.1
52 else
53 mv t-$progname.1 $output
55 else
56 mv t-$progname.1 $output
58 else
59 echo "WARNING: The man page $output cannot be updated yet."