ports/137858: [PATCH] chinese/ve: fix terminal initial problem
Hung-Yi Chen
gaod at hychen.org
Sun Aug 16 21:50:12 UTC 2009
>Number: 137858
>Category: ports
>Synopsis: [PATCH] chinese/ve: fix terminal initial problem
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Aug 16 21:50:10 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Hung-Yi Chen
>Release: FreeBSD 7.2-RELEASE-p3 i386
>Organization:
>Environment:
System: FreeBSD gaod.tfcis.org 7.2-RELEASE-p3 FreeBSD 7.2-RELEASE-p3 #3: Sat Aug 1 22:21:07 CST 2009 gaod at gaod.tfcis.org:/usr/obj/usr/src/sys/gaod i386
>Description:
Fix the terminal initial problem with color redraw.
>How-To-Repeat:
>Fix:
Apply the following path:
--- ve begins here ---
===> Generating patch
===> Viewing diff with more
diff -ruN --exclude=CVS /usr/ports/chinese/ve.orig/Makefile /usr/ports/chinese/ve/Makefile
--- /usr/ports/chinese/ve.orig/Makefile 2009-01-06 01:27:25.000000000 +0800
+++ /usr/ports/chinese/ve/Makefile 2009-08-17 05:42:47.000000000 +0800
@@ -7,7 +7,7 @@
PORTNAME= ve
PORTVERSION= 1.0
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= chinese
MASTER_SITES= LOCAL/chinsan
EXTRACT_SUFX= .tgz
diff -ruN --exclude=CVS /usr/ports/chinese/ve.orig/files/patch-Makefile /usr/ports/chinese/ve/files/patch-Makefile
--- /usr/ports/chinese/ve.orig/files/patch-Makefile 2006-03-21 05:58:01.000000000 +0800
+++ /usr/ports/chinese/ve/files/patch-Makefile 2009-08-17 05:37:14.000000000 +0800
@@ -1,5 +1,5 @@
---- Makefile.orig Wed Aug 25 14:27:23 1999
-+++ Makefile Thu Dec 18 01:29:56 2003
+--- Makefile.orig 2009-08-17 05:35:44.000000000 +0800
++++ Makefile 2009-08-17 05:37:07.000000000 +0800
@@ -1,10 +1,11 @@
-CC = gcc
+CC ?= cc
@@ -14,14 +14,12 @@
LIBS = -ltermcap -lcompat
#----------------------------------------------------------
-@@ -26,12 +27,12 @@
- rm -f *.o ve entab
+@@ -27,11 +28,11 @@
install: all
-- mkdir -p /usr/local/share/ve
+ mkdir -p /usr/local/share/ve
- cp ve /usr/local/bin
- cp 00readme.txt ve.hlp /usr/local/share/ve
-+ mkdir -p $(PREFIX)/share/ve
+ $(BSD_INSTALL_PROGRAM) ve $(PREFIX)/bin
+ $(BSD_INSTALL_DATA) 00readme.txt ve.hlp $(PREFIX)/share/ve
diff -ruN --exclude=CVS /usr/ports/chinese/ve.orig/files/patch-bbs.h /usr/ports/chinese/ve/files/patch-bbs.h
--- /usr/ports/chinese/ve.orig/files/patch-bbs.h 2008-05-01 22:08:18.000000000 +0800
+++ /usr/ports/chinese/ve/files/patch-bbs.h 2009-08-17 05:38:55.000000000 +0800
@@ -1,9 +1,18 @@
---- bbs.h.orig 2008-05-01 19:32:07.000000000 +0800
-+++ bbs.h 2008-05-01 19:45:36.000000000 +0800
-@@ -25,14 +25,6 @@
+--- bbs.h.orig 2009-08-17 05:38:33.000000000 +0800
++++ bbs.h 2009-08-17 05:38:47.000000000 +0800
+@@ -12,6 +12,7 @@
+ #define BIT8
+
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <setjmp.h>
+ #include <signal.h>
+ #include <unistd.h>
+@@ -24,14 +25,7 @@
+ #include <sys/time.h>
#include <sys/stat.h>
#include <sys/file.h>
-
+-
-
-#ifdef LINUX
-#include <bsd/sgtty.h>
@@ -11,7 +20,7 @@
-#include <sgtty.h>
-#endif
-
--
++#include <termios.h>
+
#ifdef SYSV
- #ifndef LOCK_EX
diff -ruN --exclude=CVS /usr/ports/chinese/ve.orig/files/patch-edit.c /usr/ports/chinese/ve/files/patch-edit.c
--- /usr/ports/chinese/ve.orig/files/patch-edit.c 1970-01-01 08:00:00.000000000 +0800
+++ /usr/ports/chinese/ve/files/patch-edit.c 2009-08-17 05:40:13.000000000 +0800
@@ -0,0 +1,10 @@
+--- edit.c.orig 2009-08-17 05:39:58.000000000 +0800
++++ edit.c 2009-08-17 05:40:01.000000000 +0800
+@@ -6,7 +6,6 @@
+ /* update : 95/12/15 */
+ /*-------------------------------------------------------*/
+
+-#include <stdlib.h>
+ #include <sys/param.h>
+ #include "bbs.h"
+
diff -ruN --exclude=CVS /usr/ports/chinese/ve.orig/files/patch-editor.c /usr/ports/chinese/ve/files/patch-editor.c
--- /usr/ports/chinese/ve.orig/files/patch-editor.c 2009-01-02 16:06:15.000000000 +0800
+++ /usr/ports/chinese/ve/files/patch-editor.c 1970-01-01 08:00:00.000000000 +0800
@@ -1,10 +0,0 @@
---- editor.c.orig 2008-12-21 22:42:24.000000000 +0800
-+++ editor.c 2008-12-21 22:42:35.000000000 +0800
-@@ -21,6 +21,7 @@
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-+#include <stdlib.h>
- #include "bbs.h"
-
- #define gtty(fd,data) tcgetattr(fd,data)
diff -ruN --exclude=CVS /usr/ports/chinese/ve.orig/files/patch-screen.c /usr/ports/chinese/ve/files/patch-screen.c
--- /usr/ports/chinese/ve.orig/files/patch-screen.c 2009-01-06 01:27:25.000000000 +0800
+++ /usr/ports/chinese/ve/files/patch-screen.c 2009-08-17 05:41:07.000000000 +0800
@@ -1,16 +1,15 @@
---- screen.c_orig 2008-12-21 22:41:24.000000000 +0800
-+++ screen.c 2008-12-21 22:41:40.000000000 +0800
-@@ -6,7 +6,8 @@
+--- screen.c.orig 1996-11-24 23:45:45.000000000 +0800
++++ screen.c 2009-08-17 05:34:03.000000000 +0800
+@@ -6,7 +6,7 @@
/* update : 95/12/15 */
/*-------------------------------------------------------*/
-#include <varargs.h>
+#include <stdarg.h>
-+#include <stdlib.h>
#include "bbs.h"
extern char clearbuf[];
-@@ -46,8 +47,6 @@
+@@ -46,8 +46,6 @@
{
if (!dumb_term && !big_picture)
{
@@ -19,7 +18,7 @@
scr_lns = t_lines;
scr_cols = t_columns = ANSILINELEN;
/* scr_cols = MIN(t_columns, ANSILINELEN); */
-@@ -601,13 +600,12 @@
+@@ -601,14 +599,12 @@
void
@@ -32,7 +31,8 @@
+ char buff[512];
- va_start(args);
+- fmt = va_arg(args, char *);
+ va_start(args, fmt);
- fmt = va_arg(args, char *);
vsprintf(buff, fmt, args);
va_end(args);
+ outs(buff);
diff -ruN --exclude=CVS /usr/ports/chinese/ve.orig/files/patch-term.c /usr/ports/chinese/ve/files/patch-term.c
--- /usr/ports/chinese/ve.orig/files/patch-term.c 2008-05-07 05:49:59.000000000 +0800
+++ /usr/ports/chinese/ve/files/patch-term.c 2009-08-17 05:41:45.000000000 +0800
@@ -1,27 +1,24 @@
---- term.c.orig 2008-05-01 19:34:15.000000000 +0800
-+++ term.c 2008-05-01 19:44:06.000000000 +0800
-@@ -9,17 +9,16 @@
-
+--- term.c.orig 1997-01-25 00:36:57.000000000 +0800
++++ term.c 2009-08-17 05:34:15.000000000 +0800
+@@ -10,17 +10,6 @@
#include "bbs.h"
#include <sys/ioctl.h>
-+#include <stdlib.h>
-
- #ifdef HP_UX
- #define O_HUPCL 01
- #define O_XTABS 02
- #endif
+-#ifdef HP_UX
+-#define O_HUPCL 01
+-#define O_XTABS 02
+-#endif
+-
-#ifdef LINUX
-#include <linux/termios.h>
-#define stty(fd, data) tcsetattr( fd, TCSETS, data )
-+#include <termios.h>
-+#define stty(fd, data) tcsetattr( fd, TCSANOW, data )
- #define gtty(fd, data) tcgetattr( fd, data )
+-#define gtty(fd, data) tcgetattr( fd, data )
-#endif
-
+-
#ifndef TANDEM
#define TANDEM 0x00000001
-@@ -29,11 +28,7 @@
+ #endif
+@@ -29,11 +18,7 @@
#define CBREAK 0x00000002
#endif
@@ -33,7 +30,28 @@
/* ----------------------------------------------------- */
-@@ -62,37 +57,11 @@
+@@ -44,55 +29,47 @@
+ void
+ get_tty()
+ {
+- if (gtty (1, &tty_state) < 0)
++ if (tcgetattr(1, &tty_state) < 0)
+ {
+ fprintf (stderr, "gtty failed\n");
+ exit (-1);
+ }
+ }
+
+-
++#if 0
+ void
+ init_tty()
+ {
+- if (gtty(1, &tty_state) < 0)
++ if (tcgetattr(1, &tty_state) < 0)
+ {
+ fprintf(stderr, "gtty failed\n");
+ exit(-1);
}
memcpy(&tty_new, &tty_state, sizeof(tty_new));
@@ -55,7 +73,24 @@
-
+ tty_new.c_lflag &= ~(ICANON | ECHO | ISIG);
stty(1, &tty_new);
--#endif
++}
+ #endif
++void
++init_tty(void)
++{
++ struct termios tty_state, tty_new;
++
++ if (tcgetattr(1, &tty_state) < 0) {
++ fprintf(stderr, "tcgetattr(): %m");
++ return;
++ }
++ memcpy(&tty_new, &tty_state, sizeof(tty_new));
++ tty_new.c_lflag &= ~(ICANON | ECHO | ISIG);
++ /*
++ * tty_new.c_cc[VTIME] = 0; tty_new.c_cc[VMIN] = 1;
++ */
++ tcsetattr(1, TCSANOW, &tty_new);
++ system("stty raw -echo");
}
@@ -72,16 +107,17 @@
void
reset_tty()
{
-@@ -104,8 +73,6 @@
+@@ -104,9 +81,6 @@
stty(1, &tty_new);
}
-#endif
-
-
+-
/* ----------------------------------------------------- */
-@@ -171,11 +138,7 @@
+ /* init tty control code */
+@@ -171,11 +145,7 @@
char *sbp, *s;
char *tgetstr();
===> Done
--- ve ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list