1166124Srafan#!/bin/sh 2166124Srafan############################################################################## 3262685Sdelphij# Copyright (c) 2004-2011,2012 Free Software Foundation, Inc. # 4166124Srafan# # 5166124Srafan# Permission is hereby granted, free of charge, to any person obtaining a # 6166124Srafan# copy of this software and associated documentation files (the "Software"), # 7166124Srafan# to deal in the Software without restriction, including without limitation # 8166124Srafan# the rights to use, copy, modify, merge, publish, distribute, distribute # 9166124Srafan# with modifications, sublicense, and/or sell copies of the Software, and to # 10166124Srafan# permit persons to whom the Software is furnished to do so, subject to the # 11166124Srafan# following conditions: # 12166124Srafan# # 13166124Srafan# The above copyright notice and this permission notice shall be included in # 14166124Srafan# all copies or substantial portions of the Software. # 15166124Srafan# # 16166124Srafan# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # 17166124Srafan# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # 18166124Srafan# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # 19166124Srafan# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # 20166124Srafan# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # 21166124Srafan# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # 22166124Srafan# DEALINGS IN THE SOFTWARE. # 23166124Srafan# # 24166124Srafan# Except as contained in this notice, the name(s) of the above copyright # 25166124Srafan# holders shall not be used in advertising or otherwise to promote the sale, # 26166124Srafan# use or other dealings in this Software without prior written # 27166124Srafan# authorization. # 28166124Srafan############################################################################## 29166124Srafan# 30166124Srafan# Author: Thomas E. Dickey 31166124Srafan# 32262685Sdelphij# $Id: gen_edit.sh,v 1.5 2012/04/01 15:04:37 tom Exp $ 33166124Srafan# Generate a sed-script for converting the terminfo.src to the form which will 34166124Srafan# be installed. 35166124Srafan# 36166124Srafan# Assumes: 37166124Srafan# The leaf directory names (lib, tabset, terminfo) 38166124Srafan# 39166124Srafan 40262685Sdelphijlinux_dft=linux2.2 41166124Srafan 42262685Sdelphij: ${datadir=/usr/share} 43262685Sdelphij: ${WHICH_LINUX=$linux_dft} 44262685Sdelphij: ${WHICH_XTERM=xterm-new} 45262685Sdelphij: ${XTERM_KBS=BS} 46262685Sdelphij 47166124Srafan# If we're not installing into /usr/share/, we'll have to adjust the location 48166124Srafan# of the tabset files in terminfo.src (which are in a parallel directory). 49262685SdelphijTABSET=${datadir}/tabset 50166124Srafanif test "x$TABSET" != "x/usr/share/tabset" ; then 51166124Srafancat <<EOF 52166124Srafans%/usr/share/tabset%$TABSET%g 53166124SrafanEOF 54166124Srafanfi 55166124Srafan 56262685Sdelphijif test "$WHICH_XTERM" != "xterm-new" ; then 57262685Sdelphijecho "** using $WHICH_XTERM terminal description for XTerm entry" >&2 58166124Srafancat <<EOF 59166124Srafan/^# This is xterm for ncurses/,/^$/{ 60166124Srafan s/use=xterm-new,/use=$WHICH_XTERM,/ 61166124Srafan} 62166124SrafanEOF 63166124Srafanfi 64262685Sdelphij 65262685Sdelphijif test "$XTERM_KBS" != "BS" ; then 66262685Sdelphijecho "** using DEL for XTerm backspace-key" >&2 67262685Sdelphijcat <<EOF 68262685Sdelphij/^xterm+kbs|fragment for backspace key/,/^#/{ 69262685Sdelphij s/kbs=^H,/kbs=^?,/ 70262685Sdelphij} 71262685SdelphijEOF 72262685Sdelphijfi 73262685Sdelphij 74262685Sdelphij# Work around incompatibities built into Linux console. The 2.6 series added 75262685Sdelphij# a patch to fixup the SI/SO behavior, which is closer to vt100, but the older 76262685Sdelphij# kernels do not recognize those controls. All of the kernels recognize the 77262685Sdelphij# older flavor of rmacs/smacs, but beginning in the late 1990s, changes made 78262685Sdelphij# as part of implementing UTF-8 prevent using those for line-drawing when the 79262685Sdelphij# console is in UTF-8 mode. Taking into account the fact that it took about 80262685Sdelphij# ten years to provide (and distribute) the 2.6 series' change for SI/SO, the 81262685Sdelphij# default remains "linux2.2". 82262685Sdelphijcase x$WHICH_LINUX in #(vi 83262685Sdelphijxauto) 84262685Sdelphij system=`uname -s 2>/dev/null` 85262685Sdelphij if test "x$system" = xLinux 86262685Sdelphij then 87262685Sdelphij case x`uname -r` in 88262685Sdelphij x1.*) 89262685Sdelphij WHICH_LINUX=linux-c 90262685Sdelphij ;; 91262685Sdelphij x2.[0-4]*) 92262685Sdelphij WHICH_LINUX=linux2.2 93262685Sdelphij ;; 94262685Sdelphij *) 95262685Sdelphij WHICH_LINUX=linux3.0 96262685Sdelphij ;; 97262685Sdelphij esac 98262685Sdelphij else 99262685Sdelphij WHICH_LINUX=$linux_dft 100262685Sdelphij fi 101262685Sdelphij ;; 102262685Sdelphijxlinux*) 103262685Sdelphij # allow specific setting 104262685Sdelphij ;; 105262685Sdelphij*) 106262685Sdelphij WHICH_LINUX=$linux_dft 107262685Sdelphij ;; 108262685Sdelphijesac 109262685Sdelphij 110262685Sdelphijif test $WHICH_LINUX != $linux_dft 111262685Sdelphijthen 112262685Sdelphijecho "** using $WHICH_LINUX terminal description for Linux console" >&2 113262685Sdelphijcat <<EOF 114262685Sdelphij/^# This is Linux console for ncurses/,/^$/{ 115262685Sdelphij s/use=$linux_dft,/use=$WHICH_LINUX,/ 116262685Sdelphij} 117262685SdelphijEOF 118262685Sdelphijfi 119