Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Feb 2001 20:53:09 +0100
From:      Maxime Henrion <mux@qualys.com>
To:        hackers@freebsd.org
Subject:   talk(1) patch to allow 8bits characters
Message-ID:  <20010227205309.D345@nebula.cybercable.fr>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
	Hello,

talk(1) uses the isprint() function to determine if a character is
printable. If it's not, it outputs '^' followed by the character without
his 8th bit.  However, isprint() and friends are broken currently on
FreeBSD (at least on -STABLE), so it will never recognize an accentued
character as printable.

The attached patch remove the isprint() test so that it's possible to
write special characters.  It also removes the now useless setlocale()
call and headers.

When locale support will be complete, I'm volunteer to re-introduce
this check if someone thinks it's really worth it.

Could someone review this ?

Thanks,
Maxime
-- 
Don't be fooled by cheap finnish imitations ; BSD is the One True Code
Key fingerprint = F9B6 1D5A 4963 331C 88FC  CA6A AB50 1EF2 8CBE 99D6
Public Key : http://www.epita.fr/~henrio_m/

[-- Attachment #2 --]
diff -cr talk/display.c /usr/src/usr.bin/talk/display.c
*** talk/display.c	Tue Feb 27 20:35:30 2001
--- /usr/src/usr.bin/talk/display.c	Tue Feb 27 20:39:02 2001
***************
*** 44,50 ****
   * displaying of text
   */
  #include "talk.h"
- #include <ctype.h>
  
  xwin_t	my_win;
  xwin_t	his_win;
--- 44,49 ----
***************
*** 150,162 ****
  			text++;
  			continue;
  		}
! 		if (!isprint((unsigned char)*text) && *text != '\t') {
! 			waddch(win->x_win, '^');
! 			getyx(win->x_win, win->x_line, win->x_col);
! 			cch = (*text & 63) + 64;
! 			waddch(win->x_win, cch);
! 		} else
! 			waddch(win->x_win, (unsigned char)*text);
  		getyx(win->x_win, win->x_line, win->x_col);
  		text++;
  	}
--- 149,155 ----
  			text++;
  			continue;
  		}
! 		waddch(win->x_win, (unsigned char)*text);
  		getyx(win->x_win, win->x_line, win->x_col);
  		text++;
  	}
diff -cr talk/talk.c /usr/src/usr.bin/talk/talk.c
*** talk/talk.c	Tue Feb 27 20:35:30 2001
--- /usr/src/usr.bin/talk/talk.c	Tue Feb 27 20:37:22 2001
***************
*** 46,52 ****
  #endif /* not lint */
  
  #include "talk.h"
- #include <locale.h>
  
  /*
   * talk:	A visual form of write. Using sockets, a two way
--- 46,51 ----
***************
*** 70,77 ****
  	int argc;
  	char *argv[];
  {
- 	(void) setlocale(LC_CTYPE, "");
- 
  	get_names(argc, argv);
  	check_writeable();
  	init_display();
--- 69,74 ----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010227205309.D345>