From e773470a43973120b763c287ebf8f49cb949a7b9 Mon Sep 17 00:00:00 2001 From: Hugh Graham Date: Sun, 31 Dec 2000 00:24:52 +0000 Subject: Redress PR 1547. Provide an option to pass high characters without escaping, and turn it off by default. Checked by angelos@. --- usr.bin/talk/display.c | 11 +++++------ usr.bin/talk/get_names.c | 11 +++++++++-- usr.bin/talk/talk.1 | 9 ++++++++- usr.bin/talk/talk.h | 3 ++- 4 files changed, 24 insertions(+), 10 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/talk/display.c b/usr.bin/talk/display.c index 81b67d4f02e..0276eb104a5 100644 --- a/usr.bin/talk/display.c +++ b/usr.bin/talk/display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.7 2000/12/30 06:27:48 angelos Exp $ */ +/* $OpenBSD: display.c,v 1.8 2000/12/31 00:24:51 hugh Exp $ */ /* $NetBSD: display.c,v 1.3 1994/12/09 02:14:13 jtc Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)display.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: display.c,v 1.7 2000/12/30 06:27:48 angelos Exp $"; +static char rcsid[] = "$OpenBSD: display.c,v 1.8 2000/12/31 00:24:51 hugh Exp $"; #endif /* not lint */ /* @@ -52,10 +52,8 @@ xwin_t my_win; xwin_t his_win; WINDOW *line_win; -#undef isprint -#define isprint(n) ((unsigned char)(n)>31) - int curses_initialized = 0; +int high_print = 0; /* * max HAS to be a function, it is called with @@ -152,7 +150,8 @@ display(win, text, size) /* check for wraparound */ xscroll(win, 0); } - if (!isprint(*text) && *text != '\t') { + if (*text != '\t' && + ((!high_print && !isprint(*text)) || iscntrl(*text))) { waddch(win->x_win, '^'); getyx(win->x_win, win->x_line, win->x_col); if (win->x_col == COLS-1) /* check for wraparound */ diff --git a/usr.bin/talk/get_names.c b/usr.bin/talk/get_names.c index 8f7ec926983..abed8c2eaa1 100644 --- a/usr.bin/talk/get_names.c +++ b/usr.bin/talk/get_names.c @@ -1,4 +1,4 @@ -/* $OpenBSD: get_names.c,v 1.6 1998/08/18 04:02:13 millert Exp $ */ +/* $OpenBSD: get_names.c,v 1.7 2000/12/31 00:24:51 hugh Exp $ */ /* $NetBSD: get_names.c,v 1.4 1994/12/09 02:14:16 jtc Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)get_names.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: get_names.c,v 1.6 1998/08/18 04:02:13 millert Exp $"; +static char rcsid[] = "$OpenBSD: get_names.c,v 1.7 2000/12/31 00:24:51 hugh Exp $"; #endif /* not lint */ #include "talk.h" @@ -63,6 +63,13 @@ get_names(argc, argv) register char *cp; char *names; + if (argc > 1 && !strcmp(argv[1], "-H")) { + argv[1] = argv[0]; + ++argv; + --argc; + high_print = 1; + } + if ((argc < 2 ) || ('@' == argv[1][0])) { fprintf(stderr, "usage: talk user [ttyname]\n" " talk user@hostname [ttyname]\n"); diff --git a/usr.bin/talk/talk.1 b/usr.bin/talk/talk.1 index 4d289b6599f..326db6fa8da 100644 --- a/usr.bin/talk/talk.1 +++ b/usr.bin/talk/talk.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: talk.1,v 1.12 2000/06/19 18:39:27 aaron Exp $ +.\" $OpenBSD: talk.1,v 1.13 2000/12/31 00:24:51 hugh Exp $ .\" $NetBSD: talk.1,v 1.3 1994/12/09 02:14:23 jtc Exp $ .\" .\" Copyright (c) 1983, 1990, 1993 @@ -42,6 +42,7 @@ .Nd talk to another user .Sh SYNOPSIS .Nm talk +.Op Fl H .Ar person .Op Ar ttyname .Sh DESCRIPTION @@ -69,6 +70,12 @@ is of the form .Ql ttyXX . .El .Pp +If the +.Fl H +argument is given, talk will not escape high characters. +This may be useful for certain character sets, but could cause erratic +behaviour on some terminals. +.Pp When first called, .Nm sends the message diff --git a/usr.bin/talk/talk.h b/usr.bin/talk/talk.h index 5d8c76696da..352a5eb1ad6 100644 --- a/usr.bin/talk/talk.h +++ b/usr.bin/talk/talk.h @@ -1,4 +1,4 @@ -/* $OpenBSD: talk.h,v 1.5 1999/03/03 20:43:31 millert Exp $ */ +/* $OpenBSD: talk.h,v 1.6 2000/12/31 00:24:51 hugh Exp $ */ /* $NetBSD: talk.h,v 1.3 1994/12/09 02:14:27 jtc Exp $ */ /* @@ -47,6 +47,7 @@ extern int sockt; extern int curses_initialized; extern int invitation_waiting; +extern int high_print; extern char *current_state; extern int current_line; -- cgit v1.2.3