1170530Ssam#! /bin/sh
2178354Ssam# $Id: rename.sh,v 1.4 2012/12/19 10:17:36 tom Exp $
3170530Ssam##############################################################################
4170530Ssam# Copyright (c) 2011,2012 Thomas E. Dickey                                   #
5170530Ssam#                                                                            #
6170530Ssam# Permission is hereby granted, free of charge, to any person obtaining a    #
7170530Ssam# copy of this software and associated documentation files (the "Software"), #
8170530Ssam# to deal in the Software without restriction, including without limitation  #
9170530Ssam# the rights to use, copy, modify, merge, publish, distribute, distribute    #
10170530Ssam# with modifications, sublicense, and/or sell copies of the Software, and to #
11170530Ssam# permit persons to whom the Software is furnished to do so, subject to the  #
12170530Ssam# following conditions:                                                      #
13170530Ssam#                                                                            #
14170530Ssam# The above copyright notice and this permission notice shall be included in #
15170530Ssam# all copies or substantial portions of the Software.                        #
16170530Ssam#                                                                            #
17170530Ssam# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
18170530Ssam# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
19170530Ssam# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
20170530Ssam# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
21170530Ssam# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
22170530Ssam# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
23170530Ssam# DEALINGS IN THE SOFTWARE.                                                  #
24170530Ssam#                                                                            #
25170530Ssam# Except as contained in this notice, the name(s) of the above copyright     #
26170530Ssam# holders shall not be used in advertising or otherwise to promote the sale, #
27170530Ssam# use or other dealings in this Software without prior written               #
28170530Ssam# authorization.                                                             #
29170530Ssam##############################################################################
30170530Ssam# install-helper for dialog's manpages, e.g., as "cdialog".
31170530Ssam#
32178354Ssam# $1 = input file
33170530Ssam# $2 = output file
34170530Ssam# $3 = actual program name that dialog is installed as
35170530Ssam# $4 = actual name that header/library are installed as
36170530Ssam# $5+ = install program and possible options
37170530Ssam
38170530SsamLANG=C;     export LANG
39170530SsamLC_ALL=C;   export LC_ALL
40170530SsamLC_CTYPE=C; export LC_CTYPE
41170530SsamLANGUAGE=C; export LANGUAGE
42170530Ssam
43170530SsamSOURCE=$1; shift
44170530SsamTARGET=$1; shift
45170530SsamBINARY=$1; shift
46178354SsamPACKAGE=$1; shift
47187800Ssam
48187800SsamCHR_LEAD=`echo "$BINARY" | sed -e 's/^\(.\).*/\1/'`
49178354SsamCHR_TAIL=`echo "$BINARY" | sed -e 's/^.//'`
50178354SsamONE_CAPS=`echo $CHR_LEAD | tr '[a-z]' '[A-Z]'`$CHR_TAIL
51187800SsamALL_CAPS=`echo "$BINARY" | tr '[a-z]' '[A-Z]'`
52187800Ssam
53187800Ssamsed	-e "s,^\.ds p dialog\>,.ds p $BINARY," \
54187834Ssam	-e "s,^\.ds l dialog\>,.ds l $PACKAGE," \
55178354Ssam	-e "s,^\.ds L Dialog\>,.ds L $ONE_CAPS," \
56178354Ssam	-e "s,^\.ds D DIALOG\>,.ds D $ALL_CAPS," \
57178354Ssam	-e 's,^dialog \\- ,'"$PACKAGE"' \\- ,' \
58178354Ssam	<$SOURCE >source.tmp
59178354Ssam"$@" source.tmp $TARGET
60178354Ssamrm -f source.tmp
61178354Ssam