Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | ############################################################################## |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 3 | # Copyright (c) 2004-2011,2012 Free Software Foundation, Inc. # |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 4 | # # |
| 5 | # Permission is hereby granted, free of charge, to any person obtaining a # |
| 6 | # copy of this software and associated documentation files (the "Software"), # |
| 7 | # to deal in the Software without restriction, including without limitation # |
| 8 | # the rights to use, copy, modify, merge, publish, distribute, distribute # |
| 9 | # with modifications, sublicense, and/or sell copies of the Software, and to # |
| 10 | # permit persons to whom the Software is furnished to do so, subject to the # |
| 11 | # following conditions: # |
| 12 | # # |
| 13 | # The above copyright notice and this permission notice shall be included in # |
| 14 | # all copies or substantial portions of the Software. # |
| 15 | # # |
| 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # |
| 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # |
| 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # |
| 19 | # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # |
| 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # |
| 21 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # |
| 22 | # DEALINGS IN THE SOFTWARE. # |
| 23 | # # |
| 24 | # Except as contained in this notice, the name(s) of the above copyright # |
| 25 | # holders shall not be used in advertising or otherwise to promote the sale, # |
| 26 | # use or other dealings in this Software without prior written # |
| 27 | # authorization. # |
| 28 | ############################################################################## |
| 29 | # |
| 30 | # Author: Thomas E. Dickey |
| 31 | # |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 32 | # $Id: gen_edit.sh,v 1.5 2012/04/01 15:04:37 tom Exp $ |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 33 | # Generate a sed-script for converting the terminfo.src to the form which will |
| 34 | # be installed. |
| 35 | # |
| 36 | # Assumes: |
| 37 | # The leaf directory names (lib, tabset, terminfo) |
| 38 | # |
| 39 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 40 | linux_dft=linux2.2 |
| 41 | |
| 42 | : ${datadir=/usr/share} |
| 43 | : ${WHICH_LINUX=$linux_dft} |
| 44 | : ${WHICH_XTERM=xterm-new} |
| 45 | : ${XTERM_KBS=BS} |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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). |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 49 | TABSET=${datadir}/tabset |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 50 | if test "x$TABSET" != "x/usr/share/tabset" ; then |
| 51 | cat <<EOF |
| 52 | s%/usr/share/tabset%$TABSET%g |
| 53 | EOF |
| 54 | fi |
| 55 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 56 | if test "$WHICH_XTERM" != "xterm-new" ; then |
| 57 | echo "** using $WHICH_XTERM terminal description for XTerm entry" >&2 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 58 | cat <<EOF |
| 59 | /^# This is xterm for ncurses/,/^$/{ |
| 60 | s/use=xterm-new,/use=$WHICH_XTERM,/ |
| 61 | } |
| 62 | EOF |
| 63 | fi |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 64 | |
| 65 | if test "$XTERM_KBS" != "BS" ; then |
| 66 | echo "** using DEL for XTerm backspace-key" >&2 |
| 67 | cat <<EOF |
| 68 | /^xterm+kbs|fragment for backspace key/,/^#/{ |
| 69 | s/kbs=^H,/kbs=^?,/ |
| 70 | } |
| 71 | EOF |
| 72 | fi |
| 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". |
| 82 | case x$WHICH_LINUX in #(vi |
| 83 | xauto) |
| 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 | ;; |
| 102 | xlinux*) |
| 103 | # allow specific setting |
| 104 | ;; |
| 105 | *) |
| 106 | WHICH_LINUX=$linux_dft |
| 107 | ;; |
| 108 | esac |
| 109 | |
| 110 | if test $WHICH_LINUX != $linux_dft |
| 111 | then |
| 112 | echo "** using $WHICH_LINUX terminal description for Linux console" >&2 |
| 113 | cat <<EOF |
| 114 | /^# This is Linux console for ncurses/,/^$/{ |
| 115 | s/use=$linux_dft,/use=$WHICH_LINUX,/ |
| 116 | } |
| 117 | EOF |
| 118 | fi |