15f4613f2SJohn Marino#!/bin/sh 25f4613f2SJohn Marino############################################################################## 3*32bb5217SDaniel Fojt# Copyright 2020 Thomas E. Dickey # 4*32bb5217SDaniel Fojt# Copyright 2004-2011,2012 Free Software Foundation, Inc. # 55f4613f2SJohn Marino# # 65f4613f2SJohn Marino# Permission is hereby granted, free of charge, to any person obtaining a # 75f4613f2SJohn Marino# copy of this software and associated documentation files (the "Software"), # 85f4613f2SJohn Marino# to deal in the Software without restriction, including without limitation # 95f4613f2SJohn Marino# the rights to use, copy, modify, merge, publish, distribute, distribute # 105f4613f2SJohn Marino# with modifications, sublicense, and/or sell copies of the Software, and to # 115f4613f2SJohn Marino# permit persons to whom the Software is furnished to do so, subject to the # 125f4613f2SJohn Marino# following conditions: # 135f4613f2SJohn Marino# # 145f4613f2SJohn Marino# The above copyright notice and this permission notice shall be included in # 155f4613f2SJohn Marino# all copies or substantial portions of the Software. # 165f4613f2SJohn Marino# # 175f4613f2SJohn Marino# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # 185f4613f2SJohn Marino# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # 195f4613f2SJohn Marino# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # 205f4613f2SJohn Marino# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # 215f4613f2SJohn Marino# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # 225f4613f2SJohn Marino# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # 235f4613f2SJohn Marino# DEALINGS IN THE SOFTWARE. # 245f4613f2SJohn Marino# # 255f4613f2SJohn Marino# Except as contained in this notice, the name(s) of the above copyright # 265f4613f2SJohn Marino# holders shall not be used in advertising or otherwise to promote the sale, # 275f4613f2SJohn Marino# use or other dealings in this Software without prior written # 285f4613f2SJohn Marino# authorization. # 295f4613f2SJohn Marino############################################################################## 305f4613f2SJohn Marino# 315f4613f2SJohn Marino# Author: Thomas E. Dickey 325f4613f2SJohn Marino# 33*32bb5217SDaniel Fojt# $Id: gen_edit.sh,v 1.6 2020/02/02 23:34:34 tom Exp $ 345f4613f2SJohn Marino# Generate a sed-script for converting the terminfo.src to the form which will 355f4613f2SJohn Marino# be installed. 365f4613f2SJohn Marino# 375f4613f2SJohn Marino# Assumes: 385f4613f2SJohn Marino# The leaf directory names (lib, tabset, terminfo) 395f4613f2SJohn Marino# 405f4613f2SJohn Marino 413468e90cSJohn Marinolinux_dft=linux2.2 423468e90cSJohn Marino 433468e90cSJohn Marino: ${datadir=/usr/share} 443468e90cSJohn Marino: ${WHICH_LINUX=$linux_dft} 453468e90cSJohn Marino: ${WHICH_XTERM=xterm-new} 463468e90cSJohn Marino: ${XTERM_KBS=BS} 475f4613f2SJohn Marino 485f4613f2SJohn Marino# If we're not installing into /usr/share/, we'll have to adjust the location 495f4613f2SJohn Marino# of the tabset files in terminfo.src (which are in a parallel directory). 503468e90cSJohn MarinoTABSET=${datadir}/tabset 515f4613f2SJohn Marinoif test "x$TABSET" != "x/usr/share/tabset" ; then 525f4613f2SJohn Marinocat <<EOF 535f4613f2SJohn Marinos%/usr/share/tabset%$TABSET%g 545f4613f2SJohn MarinoEOF 555f4613f2SJohn Marinofi 565f4613f2SJohn Marino 573468e90cSJohn Marinoif test "$WHICH_XTERM" != "xterm-new" ; then 583468e90cSJohn Marinoecho "** using $WHICH_XTERM terminal description for XTerm entry" >&2 595f4613f2SJohn Marinocat <<EOF 605f4613f2SJohn Marino/^# This is xterm for ncurses/,/^$/{ 615f4613f2SJohn Marino s/use=xterm-new,/use=$WHICH_XTERM,/ 625f4613f2SJohn Marino} 635f4613f2SJohn MarinoEOF 645f4613f2SJohn Marinofi 653468e90cSJohn Marino 663468e90cSJohn Marinoif test "$XTERM_KBS" != "BS" ; then 673468e90cSJohn Marinoecho "** using DEL for XTerm backspace-key" >&2 683468e90cSJohn Marinocat <<EOF 693468e90cSJohn Marino/^xterm+kbs|fragment for backspace key/,/^#/{ 703468e90cSJohn Marino s/kbs=^H,/kbs=^?,/ 713468e90cSJohn Marino} 723468e90cSJohn MarinoEOF 733468e90cSJohn Marinofi 743468e90cSJohn Marino 753468e90cSJohn Marino# Work around incompatibities built into Linux console. The 2.6 series added 763468e90cSJohn Marino# a patch to fixup the SI/SO behavior, which is closer to vt100, but the older 773468e90cSJohn Marino# kernels do not recognize those controls. All of the kernels recognize the 783468e90cSJohn Marino# older flavor of rmacs/smacs, but beginning in the late 1990s, changes made 793468e90cSJohn Marino# as part of implementing UTF-8 prevent using those for line-drawing when the 803468e90cSJohn Marino# console is in UTF-8 mode. Taking into account the fact that it took about 813468e90cSJohn Marino# ten years to provide (and distribute) the 2.6 series' change for SI/SO, the 823468e90cSJohn Marino# default remains "linux2.2". 833468e90cSJohn Marinocase x$WHICH_LINUX in #(vi 843468e90cSJohn Marinoxauto) 853468e90cSJohn Marino system=`uname -s 2>/dev/null` 863468e90cSJohn Marino if test "x$system" = xLinux 873468e90cSJohn Marino then 883468e90cSJohn Marino case x`uname -r` in 893468e90cSJohn Marino x1.*) 903468e90cSJohn Marino WHICH_LINUX=linux-c 913468e90cSJohn Marino ;; 923468e90cSJohn Marino x2.[0-4]*) 933468e90cSJohn Marino WHICH_LINUX=linux2.2 943468e90cSJohn Marino ;; 953468e90cSJohn Marino *) 963468e90cSJohn Marino WHICH_LINUX=linux3.0 973468e90cSJohn Marino ;; 983468e90cSJohn Marino esac 993468e90cSJohn Marino else 1003468e90cSJohn Marino WHICH_LINUX=$linux_dft 1013468e90cSJohn Marino fi 1023468e90cSJohn Marino ;; 1033468e90cSJohn Marinoxlinux*) 1043468e90cSJohn Marino # allow specific setting 1053468e90cSJohn Marino ;; 1063468e90cSJohn Marino*) 1073468e90cSJohn Marino WHICH_LINUX=$linux_dft 1083468e90cSJohn Marino ;; 1093468e90cSJohn Marinoesac 1103468e90cSJohn Marino 1113468e90cSJohn Marinoif test $WHICH_LINUX != $linux_dft 1123468e90cSJohn Marinothen 1133468e90cSJohn Marinoecho "** using $WHICH_LINUX terminal description for Linux console" >&2 1143468e90cSJohn Marinocat <<EOF 1153468e90cSJohn Marino/^# This is Linux console for ncurses/,/^$/{ 1163468e90cSJohn Marino s/use=$linux_dft,/use=$WHICH_LINUX,/ 1173468e90cSJohn Marino} 1183468e90cSJohn MarinoEOF 1193468e90cSJohn Marinofi 120