1251875Speter#! /bin/sh
2251875Speter# $Id: rename.sh,v 1.4 2012/12/19 10:17:36 tom Exp $
3251875Speter##############################################################################
4251875Speter# Copyright (c) 2011,2012 Thomas E. Dickey                                   #
5251875Speter#                                                                            #
6251875Speter# Permission is hereby granted, free of charge, to any person obtaining a    #
7251875Speter# copy of this software and associated documentation files (the "Software"), #
8251875Speter# to deal in the Software without restriction, including without limitation  #
9251875Speter# the rights to use, copy, modify, merge, publish, distribute, distribute    #
10251875Speter# with modifications, sublicense, and/or sell copies of the Software, and to #
11251875Speter# permit persons to whom the Software is furnished to do so, subject to the  #
12251875Speter# following conditions:                                                      #
13251875Speter#                                                                            #
14251875Speter# The above copyright notice and this permission notice shall be included in #
15251875Speter# all copies or substantial portions of the Software.                        #
16251875Speter#                                                                            #
17251875Speter# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
18251875Speter# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
19251875Speter# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
20251875Speter# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
21251875Speter# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
22251875Speter# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
23251875Speter# DEALINGS IN THE SOFTWARE.                                                  #
24251875Speter#                                                                            #
25251875Speter# Except as contained in this notice, the name(s) of the above copyright     #
26251875Speter# holders shall not be used in advertising or otherwise to promote the sale, #
27251875Speter# use or other dealings in this Software without prior written               #
28251875Speter# authorization.                                                             #
29251875Speter##############################################################################
30251875Speter# install-helper for dialog's manpages, e.g., as "cdialog".
31251875Speter#
32251875Speter# $1 = input file
33251875Speter# $2 = output file
34251875Speter# $3 = actual program name that dialog is installed as
35251875Speter# $4 = actual name that header/library are installed as
36251875Speter# $5+ = install program and possible options
37251875Speter
38251875SpeterLANG=C;     export LANG
39251875SpeterLC_ALL=C;   export LC_ALL
40251875SpeterLC_CTYPE=C; export LC_CTYPE
41251875SpeterLANGUAGE=C; export LANGUAGE
42251875Speter
43251875SpeterSOURCE=$1; shift
44251875SpeterTARGET=$1; shift
45251875SpeterBINARY=$1; shift
46251875SpeterPACKAGE=$1; shift
47251875Speter
48251875SpeterCHR_LEAD=`echo "$BINARY" | sed -e 's/^\(.\).*/\1/'`
49251875SpeterCHR_TAIL=`echo "$BINARY" | sed -e 's/^.//'`
50251875SpeterONE_CAPS=`echo $CHR_LEAD | tr '[a-z]' '[A-Z]'`$CHR_TAIL
51251875SpeterALL_CAPS=`echo "$BINARY" | tr '[a-z]' '[A-Z]'`
52251875Speter
53251875Spetersed	-e "s,^\.ds p dialog\>,.ds p $BINARY," \
54251875Speter	-e "s,^\.ds l dialog\>,.ds l $PACKAGE," \
55251875Speter	-e "s,^\.ds L Dialog\>,.ds L $ONE_CAPS," \
56251875Speter	-e "s,^\.ds D DIALOG\>,.ds D $ALL_CAPS," \
57251875Speter	-e 's,^dialog \\- ,'"$PACKAGE"' \\- ,' \
58251875Speter	<$SOURCE >source.tmp
59251875Speter"$@" source.tmp $TARGET
60251875Speterrm -f source.tmp
61251875Speter