1169695Skan#! /bin/sh
2169695Skan# $Id: rename.sh,v 1.4 2012/12/19 10:17:36 tom Exp $
3169695Skan##############################################################################
4169695Skan# Copyright (c) 2011,2012 Thomas E. Dickey                                   #
5169695Skan#                                                                            #
6169695Skan# Permission is hereby granted, free of charge, to any person obtaining a    #
7169695Skan# copy of this software and associated documentation files (the "Software"), #
8169695Skan# to deal in the Software without restriction, including without limitation  #
9169695Skan# the rights to use, copy, modify, merge, publish, distribute, distribute    #
10169695Skan# with modifications, sublicense, and/or sell copies of the Software, and to #
11169695Skan# permit persons to whom the Software is furnished to do so, subject to the  #
12169695Skan# following conditions:                                                      #
13169695Skan#                                                                            #
14169695Skan# The above copyright notice and this permission notice shall be included in #
15169695Skan# all copies or substantial portions of the Software.                        #
16169695Skan#                                                                            #
17169695Skan# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
18169695Skan# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
19169695Skan# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
20169695Skan# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
21169695Skan# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
22169695Skan# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
23169695Skan# DEALINGS IN THE SOFTWARE.                                                  #
24169695Skan#                                                                            #
25169695Skan# Except as contained in this notice, the name(s) of the above copyright     #
26169695Skan# holders shall not be used in advertising or otherwise to promote the sale, #
27169695Skan# use or other dealings in this Software without prior written               #
28169695Skan# authorization.                                                             #
29169695Skan##############################################################################
30169695Skan# install-helper for dialog's manpages, e.g., as "cdialog".
31169695Skan#
32169695Skan# $1 = input file
33169695Skan# $2 = output file
34169695Skan# $3 = actual program name that dialog is installed as
35169695Skan# $4 = actual name that header/library are installed as
36169695Skan# $5+ = install program and possible options
37169695Skan
38169695SkanLANG=C;     export LANG
39169695SkanLC_ALL=C;   export LC_ALL
40169695SkanLC_CTYPE=C; export LC_CTYPE
41169695SkanLANGUAGE=C; export LANGUAGE
42169695Skan
43169695SkanSOURCE=$1; shift
44169695SkanTARGET=$1; shift
45169695SkanBINARY=$1; shift
46169695SkanPACKAGE=$1; shift
47169695Skan
48169695SkanCHR_LEAD=`echo "$BINARY" | sed -e 's/^\(.\).*/\1/'`
49169695SkanCHR_TAIL=`echo "$BINARY" | sed -e 's/^.//'`
50169695SkanONE_CAPS=`echo $CHR_LEAD | tr '[a-z]' '[A-Z]'`$CHR_TAIL
51169695SkanALL_CAPS=`echo "$BINARY" | tr '[a-z]' '[A-Z]'`
52169695Skan
53169695Skansed	-e "s,^\.ds p dialog\>,.ds p $BINARY," \
54169695Skan	-e "s,^\.ds l dialog\>,.ds l $PACKAGE," \
55169695Skan	-e "s,^\.ds L Dialog\>,.ds L $ONE_CAPS," \
56169695Skan	-e "s,^\.ds D DIALOG\>,.ds D $ALL_CAPS," \
57169695Skan	-e 's,^dialog \\- ,'"$PACKAGE"' \\- ,' \
58169695Skan	<$SOURCE >source.tmp
59169695Skan"$@" source.tmp $TARGET
60169695Skanrm -f source.tmp
61169695Skan