use the override options if specified
[AROS.git] / arch / all-pc / boot / grub / util / grub-terminfo.in
blobe41b41836cfa0dbdee8aa9f155e7ea77ce4a14a3
1 #! /bin/sh
2 # Generate a terminfo command from a terminfo name.
4 # Copyright (C) 2002 Free Software Foundation, Inc.
6 # This file is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 VERSION=@VERSION@
22 usage () {
23 cat <<EOF
24 Usage: grub-terminfo TERMNAME
25 Generate a terminfo command from a terminfo name.
27 -h, --help print this message and exit
28 -v, --version print the version information and exit
30 Report bugs to <bug-grub@gnu.org>.
31 EOF
34 error () {
35 echo "grub-terminfo: error: $1" 1>&2
38 termname=
40 for option in "$@"; do
41 case "$option" in
42 -h | --help)
43 usage
44 exit 0 ;;
45 -v | --version)
46 echo "grub-terminfo (GNU GRUB ${VERSION})"
47 exit 0 ;;
48 -*)
49 error "Unrecognized option \`$option'"
50 usage
51 exit 1 ;;
53 if test "x$termname" != x; then
54 error "More than one terminfo names?"
55 usage
56 exit 1
58 termname="$option" ;;
59 esac
60 done
62 if test "x$termname" = x; then
63 error "termname not specified"
64 usage
65 exit 1
68 get_seq () {
69 infocmp -L -1 -g $termname | sed -n -e "/$1/s/^[^=]*=\\(.*\\),\$/\\1/p"
72 cursor_address="`get_seq cursor_address`"
73 if test "x$cursor_address" = x; then
74 error "cursor_address not found"
75 exit 1
77 cursor_address="--cursor-address=$cursor_address"
79 clear_screen="`get_seq clear_screen`"
80 if test "x$clear_screen" != x; then
81 clear_screen="--clear-screen=$clear_screen"
84 enter_standout_mode="`get_seq enter_standout_mode`"
85 if test "x$enter_standout_mode" != x; then
86 enter_standout_mode="--enter-standout-mode=$enter_standout_mode"
89 exit_standout_mode="`get_seq exit_standout_mode`"
90 if test "x$exit_standout_mode" != x; then
91 exit_standout_mode="--exit-standout-mode=$exit_standout_mode"
94 echo "terminfo --name=$termname" $cursor_address $clear_screen \
95 $enter_standout_mode $exit_standout_mode