11573Srgrimes#!/bin/sh 251933Speter############################################################################## 31573Srgrimes# Copyright (c) 2004-2011,2012 Free Software Foundation, Inc. # 41573Srgrimes# # 5119071Sobrien# Permission is hereby granted, free of charge, to any person obtaining a # 6253167Strociny# copy of this software and associated documentation files (the "Software"), # 776812Sru# to deal in the Software without restriction, including without limitation # 8163149Skmacy# the rights to use, copy, modify, merge, publish, distribute, distribute # 9211934Snwhitehorn# with modifications, sublicense, and/or sell copies of the Software, and to # 10211934Snwhitehorn# permit persons to whom the Software is furnished to do so, subject to the # 11211934Snwhitehorn# following conditions: # 12211934Snwhitehorn# # 13211934Snwhitehorn# The above copyright notice and this permission notice shall be included in # 14211934Snwhitehorn# all copies or substantial portions of the Software. # 15217745Suqs# # 16201381Sed# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # 17211934Snwhitehorn# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # 18195838Sbz# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # 19211725Simp# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # 20214904Sgonzo# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # 21211934Snwhitehorn# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # 22157911Speter# DEALINGS IN THE SOFTWARE. # 2355955Srgrimes# # 241573Srgrimes# Except as contained in this notice, the name(s) of the above copyright # 25181880Sjhb# holders shall not be used in advertising or otherwise to promote the sale, # 26181880Sjhb# use or other dealings in this Software without prior written # 27181880Sjhb# authorization. # 281573Srgrimes############################################################################## 29249344Sglebius# 30249344Sglebius# Author: Thomas E. Dickey 31249344Sglebius# 32249358Sglebius# $Id: gen_edit.sh,v 1.5 2012/04/01 15:04:37 tom Exp $ 331573Srgrimes# Generate a sed-script for converting the terminfo.src to the form which will 3443089Sbde# be installed. 351573Srgrimes# 361573Srgrimes# Assumes: 371573Srgrimes# The leaf directory names (lib, tabset, terminfo) 38# 39 40linux_dft=linux2.2 41 42: ${datadir=/usr/share} 43: ${WHICH_LINUX=$linux_dft} 44: ${WHICH_XTERM=xterm-new} 45: ${XTERM_KBS=BS} 46 47# If we're not installing into /usr/share/, we'll have to adjust the location 48# of the tabset files in terminfo.src (which are in a parallel directory). 49TABSET=${datadir}/tabset 50if test "x$TABSET" != "x/usr/share/tabset" ; then 51cat <<EOF 52s%/usr/share/tabset%$TABSET%g 53EOF 54fi 55 56if test "$WHICH_XTERM" != "xterm-new" ; then 57echo "** using $WHICH_XTERM terminal description for XTerm entry" >&2 58cat <<EOF 59/^# This is xterm for ncurses/,/^$/{ 60 s/use=xterm-new,/use=$WHICH_XTERM,/ 61} 62EOF 63fi 64 65if test "$XTERM_KBS" != "BS" ; then 66echo "** using DEL for XTerm backspace-key" >&2 67cat <<EOF 68/^xterm+kbs|fragment for backspace key/,/^#/{ 69 s/kbs=^H,/kbs=^?,/ 70} 71EOF 72fi 73 74# Work around incompatibities built into Linux console. The 2.6 series added 75# a patch to fixup the SI/SO behavior, which is closer to vt100, but the older 76# kernels do not recognize those controls. All of the kernels recognize the 77# older flavor of rmacs/smacs, but beginning in the late 1990s, changes made 78# as part of implementing UTF-8 prevent using those for line-drawing when the 79# console is in UTF-8 mode. Taking into account the fact that it took about 80# ten years to provide (and distribute) the 2.6 series' change for SI/SO, the 81# default remains "linux2.2". 82case x$WHICH_LINUX in #(vi 83xauto) 84 system=`uname -s 2>/dev/null` 85 if test "x$system" = xLinux 86 then 87 case x`uname -r` in 88 x1.*) 89 WHICH_LINUX=linux-c 90 ;; 91 x2.[0-4]*) 92 WHICH_LINUX=linux2.2 93 ;; 94 *) 95 WHICH_LINUX=linux3.0 96 ;; 97 esac 98 else 99 WHICH_LINUX=$linux_dft 100 fi 101 ;; 102xlinux*) 103 # allow specific setting 104 ;; 105*) 106 WHICH_LINUX=$linux_dft 107 ;; 108esac 109 110if test $WHICH_LINUX != $linux_dft 111then 112echo "** using $WHICH_LINUX terminal description for Linux console" >&2 113cat <<EOF 114/^# This is Linux console for ncurses/,/^$/{ 115 s/use=$linux_dft,/use=$WHICH_LINUX,/ 116} 117EOF 118fi 119