- Fix the terminal initial problem with color redraw

- Pass maintainership to submitter

PR:		ports/137858
Submitted by:	Hung-Yi Chen <gaod@hychen.org>
This commit is contained in:
Alexander Logvinov 2009-10-07 06:10:05 +00:00
parent e2e3e795eb
commit 045195c2ea
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=242534
5 changed files with 84 additions and 48 deletions

View File

@ -7,12 +7,12 @@
PORTNAME= ve
PORTVERSION= 1.0
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= chinese
MASTER_SITES= LOCAL/chinsan
EXTRACT_SUFX= .tgz
MAINTAINER= ports@FreeBSD.org
MAINTAINER= gaod@hychen.org
COMMENT= NTHU-CS Maple BBS 2.36 BBS-like editor
.include <bsd.port.mk>

View File

@ -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-10-06 23:10:03.000000000 +0800
+++ bbs.h 2009-10-06 23:14:01.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

View File

@ -1,10 +1,10 @@
--- 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.
*/
--- edit.c.orig 2009-10-06 23:06:44.000000000 +0800
+++ edit.c 2009-10-06 23:06:57.000000000 +0800
@@ -6,7 +6,6 @@
/* update : 95/12/15 */
/*-------------------------------------------------------*/
+#include <stdlib.h>
-#include <stdlib.h>
#include <sys/param.h>
#include "bbs.h"
#define gtty(fd,data) tcgetattr(fd,data)

View File

@ -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 2009-10-06 23:07:16.000000000 +0800
+++ screen.c 2009-10-06 23:15:01.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,13 @@
void
@ -30,9 +29,11 @@
va_list args;
- char buff[512], *fmt;
+ char buff[512];
+
+ va_start(args, fmt);
- va_start(args);
+ va_start(args, fmt);
fmt = va_arg(args, char *);
- fmt = va_arg(args, char *);
vsprintf(buff, fmt, args);
va_end(args);
outs(buff);

View File

@ -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 2009-10-06 23:10:29.000000000 +0800
+++ term.c 2009-10-06 23:20:40.000000000 +0800
@@ -10,16 +10,7 @@
#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
+#define stty(fd, data) tcsetattr( fd, TCSANOW, data )
#ifndef TANDEM
#define TANDEM 0x00000001
@@ -29,11 +28,7 @@
@@ -29,11 +20,7 @@
#define CBREAK 0x00000002
#endif
@ -33,10 +30,29 @@
/* ----------------------------------------------------- */
@@ -62,37 +57,11 @@
}
memcpy(&tty_new, &tty_state, sizeof(tty_new));
@@ -44,7 +31,7 @@
void
get_tty()
{
- if (gtty (1, &tty_state) < 0)
+ if (tcgetattr(1, &tty_state) < 0)
{
fprintf (stderr, "gtty failed\n");
exit (-1);
@@ -53,46 +40,23 @@
void
-init_tty()
+init_tty(void)
{
- if (gtty(1, &tty_state) < 0)
- {
- fprintf(stderr, "gtty failed\n");
- exit(-1);
- }
- memcpy(&tty_new, &tty_state, sizeof(tty_new));
-
-#ifdef LINUX
-
- tty_new.c_lflag &= ~(ICANON | ECHO | RAW | ISIG);
@ -52,13 +68,24 @@
-#else
- tty_new.sg_flags &= ~(TANDEM | CBREAK | LCASE | ECHO | CRMOD);
-#endif
-
+ tty_new.c_lflag &= ~(ICANON | ECHO | ISIG);
stty(1, &tty_new);
+ struct termios tty_state, tty_new;
- stty(1, &tty_new);
-#endif
+ 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");
}
-
-#ifdef LINUX
-reset_tty()
-{
@ -72,16 +99,15 @@
void
reset_tty()
{
@@ -104,8 +73,6 @@
@@ -104,7 +68,6 @@
stty(1, &tty_new);
}
-#endif
-
/* ----------------------------------------------------- */
@@ -171,11 +138,7 @@
@@ -171,11 +134,7 @@
char *sbp, *s;
char *tgetstr();