mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-21 23:02:40 +00:00
* docs/Makefile.am (man_MANS): Added grub-terminfo.8. ($(srcdir)/grub_terminfo.8): New target. * utils/grub-terminfo.in: New file. * util/Makefile.am (sbin_SCRIPTS): Added grub-terminfo. * configure.in (AC_OUTPUT): Added util/grub-terminfo. * docs/grub.texi (terminfo): New subsection. (Invoking grub-terminfo): New chapter. From Tilmann Bubeck <t.bubeck@reinform.de>: * stage2/Makefile.am (noinst_HEADERS): Added terminfo.h and tparm.h. (libgrub_a_SOURCES): Added terminfo.c and tparm.c. (pre_stage2_exe_SOURCES): Likewise. * stage2/terminfo.c: New file. * stage2/terminfo.h: Likewise. * stage2/tparm.c: Likewise. * stage2/tparm.h: Likewise. * stage2/stage2.c (get_line_from_config): Fix handling of backslashes. * stage2/char_io.c (grub_putstr): New function. (grub_printf): Use grub_putstr. (substring): Add const into both arguments. * stage2/builtins.c [SUPPORT_SERIAL]: Include terminfo.h. [SUPPORT_SERIAL] (terminfo_func): New function. [SUPPORT_SERIAL] (builtin_terminfo): New variable. (builtin_table) [SUPPORT_SERIAL]: Added a pointer to BUILTIN_TERMINFO. * stage2/serial.c (serial_gotoxy): Use ti_cursor_address. (serial_cls): Use ti_clear_screen. (serial_highlight): use ti_enter_standout_mode and ti_exit_standout_mode.
96 lines
2.4 KiB
Bash
96 lines
2.4 KiB
Bash
#! /bin/sh
|
|
# Generate a terminfo command from a terminfo name.
|
|
#
|
|
# Copyright (C) 2002 Free Software Foundation, Inc.
|
|
#
|
|
# This file is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
VERSION=@VERSION@
|
|
|
|
usage () {
|
|
cat <<EOF
|
|
Usage: grub-terminfo TERMNAME
|
|
Generate a terminfo command from a terminfo name.
|
|
|
|
-h, --help print this message and exit
|
|
-v, --version print the version information and exit
|
|
|
|
Report bugs to <bug-grub@gnu.org>.
|
|
EOF
|
|
}
|
|
|
|
error () {
|
|
echo "grub-terminfo: error: $1" 1>&2
|
|
}
|
|
|
|
termname=
|
|
|
|
for option in "$@"; do
|
|
case "$option" in
|
|
-h | --help)
|
|
usage
|
|
exit 0 ;;
|
|
-v | --version)
|
|
echo "grub-terminfo (GNU GRUB ${VERSION})"
|
|
exit 0 ;;
|
|
-*)
|
|
error "Unrecognized option \`$option'"
|
|
usage
|
|
exit 1 ;;
|
|
*)
|
|
if test "x$termname" != x; then
|
|
error "More than one terminfo names?"
|
|
usage
|
|
exit 1
|
|
fi
|
|
termname="$option" ;;
|
|
esac
|
|
done
|
|
|
|
if test "x$termname" = x; then
|
|
error "termname not specified"
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
get_seq () {
|
|
infocmp -L -1 -g $termname | sed -n -e "/$1/s/^[^=]*=\\(.*\\),\$/\\1/p"
|
|
}
|
|
|
|
cursor_address="`get_seq cursor_address`"
|
|
if test "x$cursor_address" = x; then
|
|
error "cursor_address not found"
|
|
exit 1
|
|
fi
|
|
cursor_address="--cursor-address=$cursor_address"
|
|
|
|
clear_screen="`get_seq clear_screen`"
|
|
if test "x$clear_screen" != x; then
|
|
clear_screen="--clear-screen=$clear_screen"
|
|
fi
|
|
|
|
enter_standout_mode="`get_seq enter_standout_mode`"
|
|
if test "x$enter_standout_mode" != x; then
|
|
enter_standout_mode="--enter-standout-mode=$enter_standout_mode"
|
|
fi
|
|
|
|
exit_standout_mode="`get_seq exit_standout_mode`"
|
|
if test "x$exit_standout_mode" != x; then
|
|
exit_standout_mode="--exit-standout-mode=$exit_standout_mode"
|
|
fi
|
|
|
|
echo "terminfo --name=$termname" $cursor_address $clear_screen \
|
|
$enter_standout_mode $exit_standout_mode
|