• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/gettext-0.17/gettext-tools/man/
1#! /bin/sh
2#
3# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
4#
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 3 of the License, or
8# (at your option) any later version.
9#
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.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17#
18
19# This program creates a program's manual from the .x skeleton and its --help
20# output.
21
22update=
23while true; do
24  case "$1" in
25    --update) update=yes; shift;;
26    *) break;;
27  esac
28done
29
30if test $# != 5; then
31  echo "Usage: x-to-1 [OPTIONS] PERL HELP2MAN executable program.x program.1" 1>&2
32  exit 1
33fi
34PERL="$1"
35HELP2MAN="$2"
36executable="$3"
37aux="$4"
38output="$5"
39
40progname=`basename $aux .x`
41case "$PERL" in *"/missing perl") perlok=no;; *) perlok=yes;; esac
42if test yes = no && test -f $executable && test $perlok = yes; then
43  echo "Updating man page $output"
44  echo "$HELP2MAN --include=$aux $executable > $output"
45  rm -f t-$progname.1
46  $HELP2MAN --include=$aux $executable > t-$progname.1 || exit 1
47  if test -n "$update"; then
48    # In --update mode, don't overwrite the output if nothing would change.
49    if cmp t-$progname.1 $output >/dev/null 2>&1; then
50      rm -f t-$progname.1
51    else
52      mv t-$progname.1 $output
53    fi
54  else
55    mv t-$progname.1 $output
56  fi
57else
58  echo "WARNING: The man page $output cannot be updated yet."
59fi
60