Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/tset Restore logic for setting the VERASE character.
details: https://anonhg.NetBSD.org/src/rev/28eb5d25614d
branches: trunk
changeset: 338982:28eb5d25614d
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sun Jun 21 08:23:22 2015 +0000
description:
Restore logic for setting the VERASE character.
- use terminfo _unless_ the terminal does overstrike.
- use terminfo data not only for an unset tty.
diffstat:
usr.bin/tset/set.c | 28 +++++++++++++++-------------
1 files changed, 15 insertions(+), 13 deletions(-)
diffs (50 lines):
diff -r ab27966f3c22 -r 28eb5d25614d usr.bin/tset/set.c
--- a/usr.bin/tset/set.c Sun Jun 21 07:45:10 2015 +0000
+++ b/usr.bin/tset/set.c Sun Jun 21 08:23:22 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: set.c,v 1.17 2012/04/21 12:27:30 roy Exp $ */
+/* $NetBSD: set.c,v 1.18 2015/06/21 08:23:22 mlelstv Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: set.c,v 1.17 2012/04/21 12:27:30 roy Exp $");
+__RCSID("$NetBSD: set.c,v 1.18 2015/06/21 08:23:22 mlelstv Exp $");
#include <err.h>
#include <stdio.h>
@@ -151,18 +151,20 @@
void
set_control_chars(int erasechar, int intrchar, int killchar)
{
+ int bs_char;
+
+ if (key_backspace != NULL && key_backspace[1] == '\0')
+ bs_char = key_backspace[0];
+ else
+ bs_char = 0;
- if (mode.c_cc[VERASE] == 0 || erasechar != 0) {
- if (erasechar == 0) {
- if (over_strike &&
- key_backspace != NULL &&
- key_backspace[1] == '\0')
- mode.c_cc[VERASE] = key_backspace[1];
- else
- mode.c_cc[VERASE] = CERASE;
- } else
- mode.c_cc[VERASE] = erasechar;
- }
+ if (erasechar == 0 && bs_char != 0 && !over_strike)
+ erasechar = -1;
+ if (erasechar < 0)
+ erasechar = (bs_char != 0) ? bs_char : CTRL('h');
+
+ if (mode.c_cc[VERASE] == 0 || erasechar != 0)
+ mode.c_cc[VERASE] = erasechar ? erasechar : CERASE;
if (mode.c_cc[VINTR] == 0 || intrchar != 0)
mode.c_cc[VINTR] = intrchar ? intrchar : CINTR;
Home |
Main Index |
Thread Index |
Old Index