- Update han to work in 4.x. Use patches from kon2-16dot.

(it still has a bug: cursor doesn't displayed)
- distfile location moved.
This commit is contained in:
CHOI Junho 2000-07-16 09:01:54 +00:00
parent 398ecef161
commit f38f930b0b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=30683
15 changed files with 586 additions and 9 deletions

View file

@ -1,6 +1,6 @@
# New ports collection makefile for: han
# Date created: 12 Apr 1997
# Whom: Choi Jun Ho <junker@jazz.snu.ac.kr>
# Whom: CHOI Junho <cjh@FreeBSD.org>
#
# $FreeBSD$
#
@ -8,11 +8,12 @@
PORTNAME= han
PORTVERSION= 1.0fb
CATEGORIES= korean
MASTER_SITES= ftp://jazz.snu.ac.kr/pub/unix/FreeBSD-kr/source/han/
MASTER_SITES= ftp://ftp.kr.freebsd.org/pub/FreeBSD-kr/distfiles/ \
ftp://jazz.snu.ac.kr/pub/unix/FreeBSD-kr/source/han/
ONLY_FOR_ARCHS= i386
USE_GMAKE= yes
USE_GMAKE= YES
post-configure:
${SED} -e 's%%WRKSRC%%${WRKSRC}' \

71
korean/han/files/patch-aa Normal file
View file

@ -0,0 +1,71 @@
--- src/vc.c.orig Sat Mar 29 04:35:50 1997
+++ src/vc.c Sun Jul 16 12:44:05 2000
@@ -310,12 +310,23 @@
{
struct vt_mode vtm;
+#if defined(__FreeBSD__)
+ signal(SIGUSR1, SIG_IGN);
+ signal(SIGUSR2, SIG_IGN);
+#else /* linux */
signal(SIGUSR1, SIG_DFL);
signal(SIGUSR2, SIG_DFL);
+#endif
vtm.mode = VT_AUTO;
vtm.waitv = 0;
+#if defined(__FreeBSD__)
+ vtm.relsig = SIGUSR1;
+ vtm.acqsig = SIGUSR2;
+ vtm.frsig = SIGUSR1;
+#else /* linux */
vtm.relsig = 0;
vtm.acqsig = 0;
+#endif
ioctl(0, VT_SETMODE, &vtm);
#if defined(__FreeBSD__)
ioctl(0, VT_RELDISP, 1);
@@ -341,6 +352,9 @@
vtm.waitv = 0;
vtm.relsig = SIGUSR1;
vtm.acqsig = SIGUSR2;
+#if defined(__FreeBSD__)
+ vtm.frsig = SIGUSR1;
+#endif
ioctl(0, VT_SETMODE, &vtm);
vInfo.graph_mode();
if (useHardScroll)
@@ -859,20 +873,31 @@
static int ConfigBeep(const char *confstr)
{
- beepCount = atoi(confstr) * 10000;
#if defined(linux)
- ioperm(COUNTER_ADDR, 1, TRUE);
+ beepCount = atoi(confstr) * 10000;
+ if (beepCount > 0)
+ ioperm(COUNTER_ADDR, 1, TRUE);
+#endif
+#if defined(__FreeBSD__)
+ beepCount = atoi(confstr) * 10;
#endif
return SUCCESS;
}
+#define BELL_PITCH 800
+
void Beep(void)
{
- if (!con.active) return;
#ifdef linux
+ if (!con.active) return;
PortOutb(PortInb(COUNTER_ADDR)|3, COUNTER_ADDR);
usleep(beepCount);
PortOutb(PortInb(COUNTER_ADDR)&0xFC, COUNTER_ADDR);
+#endif
+#if defined(__FreeBSD__)
+ if(beepCount <= 0) return;
+ ioctl(fileno(stdout), KDMKTONE, (BELL_PITCH & 0xffff) |
+ ((beepCount & 0xffff) << 16));
#endif
}

44
korean/han/files/patch-ab Normal file
View file

@ -0,0 +1,44 @@
--- src/child.c.orig Sat Mar 29 05:29:53 1997
+++ src/child.c Sun Jul 16 12:48:02 2000
@@ -26,6 +26,7 @@
#ifdef __FreeBSD__
#include <errno.h>
+#include <sys/ioctl.h>
#endif
#include <getcap.h>
@@ -98,6 +99,9 @@
{
char *shell, *tail, *tcap;
char buff[80];
+#if defined(__FreeBSD__)
+ struct winsize win;
+#endif
setgid(getgid());
setuid(getuid());
@@ -107,6 +111,10 @@
sprintf(buff, "TERMCAP=:co#%d:li#%d:tc=console:",
dInfo.txmax + 1, dInfo.tymax + 1);
#elif defined(__FreeBSD__)
+ win.ws_row = dInfo.tymax + 1;
+ win.ws_col = dInfo.txmax + 1;
+ win.ws_xpixel = win.ws_ypixel = 0;
+ ioctl(STDIN_FILENO, TIOCSWINSZ, &win);
sprintf(buff,"TERM=vt100");
#endif
tcap = strdup(buff);
@@ -120,10 +128,10 @@
"HAN is free software, and you are welcome to redistribute it\r\n"
"HAN under certain conditions; show COPYING for details.\r\n");
#if defined(__FreeBSD__)
- printf("\rHAN for FreeBSD-2.x\r\n");
+ printf("\rHAN for FreeBSD\r\n");
#endif
}
- printf("HAN using VT number %c.\n\n",
+ printf("HAN using VT number %c.\r\n",
#if defined(linux)
*(ttyname(fileno(errfp))+8));
#elif defined(__FreeBSD__)

21
korean/han/files/patch-af Normal file
View file

@ -0,0 +1,21 @@
--- src/term.c.orig Sat Mar 29 04:36:54 1997
+++ src/term.c Sun Jul 16 12:50:34 2000
@@ -209,6 +209,9 @@
}
if (FD_ISSET(0, &readFds)) {
i = read(0, buff, BUFSIZ);
+#if defined(__FreeBSD__)
+ i = cons25tovt100(buff, i, BUFSIZ);
+#endif
#if 1
{
int k, l;
@@ -239,7 +242,7 @@
PollCursor(TRUE);
}
if (FD_ISSET(sockFd, &readFds)) SocketInterface(sockFd);
- if (mInfo.has_mouse) {
+ if (mInfo.has_mouse && mouseFd > 0) {
if (FD_ISSET(mouseFd, &readFds) && con.active) {
i = read(mouseFd, buff, BUFSIZ);
if (i > 0) MouseGetPacket(buff, i);

103
korean/han/files/patch-ag Normal file
View file

@ -0,0 +1,103 @@
--- src/utmp.c.orig Fri Jan 24 09:37:28 1997
+++ src/utmp.c Sat Apr 26 21:50:30 1997
@@ -41,20 +41,32 @@
#include <utmp.h>
#include <grp.h>
#include <sys/stat.h>
+#if defined(__FreeBSD__)
+#include <ttyent.h>
+#endif
+#if !defined(__FreeBSD__)
static int ttyGid;
+#else
+static gid_t ttyGid;
+static int ts;
+#endif
void SetUtmp(char *tty)
{
-#ifdef linux
struct utmp utmp;
struct passwd *pw;
struct group *ttygrp;
char *tn;
+#if defined(__FreeBSD__)
+ struct ttyent *ttyp;
+ int fd, i;
+#endif
pw = getpwuid(getuid());
tn = rindex(tty, '/') + 1;
memset((char *)&utmp, 0, sizeof(utmp));
+#if !defined(__FreeBSD__)
strncpy(utmp.ut_id, tn + 3, sizeof(utmp.ut_id));
utmp.ut_type = DEAD_PROCESS;
setutent();
@@ -66,21 +78,43 @@
time(&(utmp.ut_time));
pututline(&utmp);
endutent();
+#else
+ time(&(utmp.ut_time));
+ strncpy(utmp.ut_name, pw->pw_name, sizeof(utmp.ut_name));
+ strncpy(utmp.ut_line, tn, sizeof(utmp.ut_line));
+ setttyent();
+ ts = 0;
+ for (i = 1; (ttyp = getttyent()); ++i)
+ if (!strcmp(ttyp->ty_name,tn)) {
+ ts = i;
+ break;
+ }
+ endttyent();
+ if (ts > 0 && (fd = open(_PATH_UTMP, O_WRONLY|O_CREAT, 0644)) >= 0) {
+ lseek(fd, (ts*sizeof(struct utmp)), L_SET);
+ write(fd, &utmp, sizeof(struct utmp));
+ close(fd);
+ }
+#endif
if ((ttygrp = getgrnam("tty")) != NULL)
ttyGid = ttygrp->gr_gid;
else
ttyGid = -1;
chmod(tty, 0622);
chown(tty, getuid(), ttyGid);
-#endif
}
void ResetUtmp(char *tty)
{
-#ifdef linux
+#if !defined(__FreeBSD__)
struct utmp utmp, *utp;
char *tn;
+#else
+ struct utmp utmp;
+ int fd;
+#endif
+#if !defined(__FreeBSD__)
tn = rindex(tty, '/') + 4;
memset((char *)&utmp, 0, sizeof(utmp));
strncpy(utmp.ut_id, tn, sizeof(utmp.ut_id));
@@ -93,7 +127,19 @@
time(&(utp->ut_time));
pututline(utp);
endutent();
+#else
+ if (ts > 0 && (fd = open(_PATH_UTMP, O_RDWR, 0)) >= 0) {
+ lseek(fd, (ts*sizeof(struct utmp)), L_SET);
+ if (read(fd, &utmp, sizeof(struct utmp)) == sizeof(struct utmp)) {
+ bzero(utmp.ut_name, sizeof(utmp.ut_name));
+ bzero(utmp.ut_host, sizeof(utmp.ut_host));
+ time(&utmp.ut_time);
+ lseek(fd, (ts*sizeof(struct utmp)), L_SET);
+ write(fd, &utmp, sizeof(struct utmp));
+ }
+ close(fd);
+ }
+#endif
chmod(tty, 0600);
chown(tty, 0, ttyGid);
-#endif
}

23
korean/han/files/patch-ah Normal file
View file

@ -0,0 +1,23 @@
--- src/display/vga.c.orig Wed Apr 9 21:34:02 1997
+++ src/display/vga.c Sun Jul 16 12:52:41 2000
@@ -379,7 +379,7 @@
/* if (!code) return;*/
VgaSetColor(fc);
if (bc & 0x8) *(vcls - dInfo.glineByte) = 0;
- for (x = 0;x < sbFReg->high;x ++, code ++, fm >>= 1) {
+ if (code) for (x = 0;x < sbFReg->high;x ++, code ++, fm >>= 1) {
if (*code) {
VgaOutByte(*code);
*gram = *gram;
@@ -617,7 +617,11 @@
Perror("ioctl CONSOLE_IO_ENABLE/KDSETMODE");
return FAILURE;
}
+#if (__FreeBSD__ <= 3)
if ((devMem = open("/dev/vga", O_RDWR|O_NDELAY) ) < 0) {
+#else
+ if ((devMem = open("/dev/mem", O_RDWR|O_NDELAY) ) < 0) {
+#endif
Perror("/dev/mem");
return FAILURE;
}

25
korean/han/files/patch-ak Normal file
View file

@ -0,0 +1,25 @@
--- include/vt.h.orig Fri Jan 24 16:08:13 1997
+++ include/vt.h Sat Aug 7 05:06:49 1999
@@ -59,7 +59,12 @@
ins,
active,
wrap,
+#if defined(__FreeBSD__)
+ text_mode,
+ cursor_key_mode;
+#else
text_mode;
+#endif
};
extern struct _con_info con;
@@ -75,6 +80,9 @@
extern void VtStart(void);
extern void VtEmu(const char*, int nchars);
extern void VtCleanup(void);
+#if defined(__FreeBSD__)
+extern int cons25tovt100(u_char *buff, int len, const int max);
+#endif
#define sjistojis(ch, cl)\
{\

159
korean/han/files/patch-al Normal file
View file

@ -0,0 +1,159 @@
--- src/vt.c.orig Sat Jan 25 17:55:02 1997
+++ src/vt.c Sat Aug 7 05:09:15 1999
@@ -185,6 +185,11 @@
static void VtSetMode(u_char mode, bool sw)
{
switch(mode) {
+#if defined(__FreeBSD__)
+ case 1:
+ con.cursor_key_mode = sw;
+ break;
+#endif
case 4:
con.ins = sw;
break;
@@ -654,4 +659,144 @@
con.sb = lInfo.sb;
con.db = lInfo.db|LATCH_1;
con.active = cInfo.sw = TRUE;
+#if defined(__FreeBSD__)
+ con.cursor_key_mode = FALSE;
+#endif
}
+
+#if defined(__FreeBSD__)
+
+static int ReplaceString(char *sp, const int len, const int maxlen,
+ const int oldlen, const char *newstr)
+{
+ int newlen, copylen, diff;
+
+ newlen = strlen(newstr);
+ diff = newlen - oldlen;
+ copylen = len - oldlen;
+
+ if(len + diff > maxlen){
+ diff -= (len + diff - maxlen);
+ copylen = maxlen - newlen;
+ }
+ if(copylen > 0)
+ memcpy(sp + newlen, sp + oldlen, copylen);
+
+ copylen = newlen;
+ if(newlen > maxlen){
+ copylen = maxlen;
+ diff = maxlen - len;
+ }
+ if(copylen > 0)
+ memcpy(sp, newstr, copylen);
+
+ return(diff);
+}
+
+int cons25tovt100(u_char *buff, int len, const int max)
+{
+ u_char *p;
+ int i;
+ int newlen = len;
+
+ p = buff;
+
+ for(i=0; i<newlen; i++, p++){
+ switch(*p){
+ case '\177':
+ newlen += ReplaceString(p, len-i, max-i, 1, "\x1b[3~");
+ i += 3; p += 3;
+ break;
+ case '\033': /* ESC */
+ if(i + 2 <= newlen && *(p+1) == '['){
+ switch(*(p+2)){
+ case 'A': /* up arrow */
+ if(con.cursor_key_mode)
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1bOA");
+ break;
+ case 'B': /* down arrow */
+ if(con.cursor_key_mode)
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1bOB");
+ break;
+ case 'C': /* right arrow */
+ if(con.cursor_key_mode)
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1bOC");
+ break;
+ case 'D': /* left arrow */
+ if(con.cursor_key_mode)
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1bOD");
+ break;
+ case 'L': /* insert */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[2~");
+ i++; p++;
+ break;
+ case 'H': /* home key */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[4~");
+ i++; p++;
+ break;
+ case 'I': /* prev page */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[5~");
+ i++; p++;
+ break;
+ case 'G': /* next page */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[6~");
+ i++; p++;
+ break;
+ case 'M': /* F1 */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[11~");
+ i += 2; p += 2;
+ break;
+ case 'N': /* F2 */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[12~");
+ i += 2; p += 2;
+ break;
+ case 'O': /* F3 */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[13~");
+ i += 2; p += 2;
+ break;
+ case 'P': /* F4 */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[14~");
+ i += 2; p += 2;
+ break;
+ case 'Q': /* F5 */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[15~");
+ i += 2; p += 2;
+ break;
+ case 'R': /* F6 */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[17~");
+ i += 2; p += 2;
+ break;
+ case 'S': /* F7 */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[18~");
+ i += 2; p += 2;
+ break;
+ case 'T': /* F8 */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[19~");
+ i += 2; p += 2;
+ break;
+ case 'U': /* F9 */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[20~");
+ i += 2; p += 2;
+ break;
+ case 'V': /* F10 */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[21~");
+ i += 2; p += 2;
+ break;
+ case 'W': /* F11 */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[23~");
+ i += 2; p += 2;
+ break;
+ case 'X': /* F12 */
+ newlen += ReplaceString(p, len-i, max-i, 3, "\x1b[24~");
+ i += 2; p += 2;
+ break;
+ }
+ i += 2; p += 2;
+ }
+ }
+ }
+
+ return(newlen);
+}
+
+#endif

15
korean/han/files/patch-am Normal file
View file

@ -0,0 +1,15 @@
--- include/vga.h.orig Fri Jan 24 16:08:01 1997
+++ include/vga.h Mon Jan 31 14:13:08 2000
@@ -59,7 +59,11 @@
#if defined(linux)
#define GRAPH_BASE 0xA0000
#elif defined(__FreeBSD__)
-#define GRAPH_BASE 0x0
+# if (__FreeBSD__ <= 3)
+# define GRAPH_BASE 0x0
+# else
+# define GRAPH_BASE 0xA0000
+# endif
#endif
#define FONT_SIZE 0x2000

35
korean/han/files/patch-ba Normal file
View file

@ -0,0 +1,35 @@
diff -ur include/mem.h.old include/mem.h
--- include/mem.h.old Tue Jan 25 20:16:57 2000
+++ include/mem.h Tue Jan 25 20:30:48 2000
@@ -46,6 +46,7 @@
"d" ((u_short) port));
}
+#if 0
static inline
void lzero(void *head, int n)
{
@@ -93,11 +94,23 @@
"D" ((long)head)
:"cx","di");
}
+#endif
extern u_char PortInb(u_short);
+#if 1
+#define bzero(b, len) bzero(b, len)
+#define bzero2(b, len) bzero(b, len)
+#define lzero(b, len) bzero(b, len)
+#define wzero(b, len) bzero(b, len)
+#define bmove(dst, src, len) bcopy(src, dst, len)
+#define brmove(dst, src, len) bcopy(src, dst, len)
+#define wmove(dst, src, len) bcopy(src, dst, len)
+#define lmove(dst, src, len) bcopy(src, dst, len)
+#else
extern void wzero(void *, int);
extern void wmove(void *, void *, int);
extern void lmove(void *, void *, int);
+#endif
extern void SafeFree(void **);
#endif

19
korean/han/files/patch-bb Normal file
View file

@ -0,0 +1,19 @@
diff -ur lib/mem.c.old lib/mem.c
--- lib/mem.c.old Tue Jan 25 20:16:57 2000
+++ lib/mem.c Tue Jan 25 20:28:18 2000
@@ -44,6 +44,7 @@
return(_rval);
}
+#if 0
void wzero(void *head, int n)
{
__asm__ ("cld\n\t"
@@ -76,6 +77,7 @@
"S" ((long)src)
:"cx","di","si");
}
+#endif
void SafeFree(void **p)
{

12
korean/han/files/patch-bc Normal file
View file

@ -0,0 +1,12 @@
diff -ur src/main.c.old src/main.c
--- src/main.c.old Tue Jan 25 20:16:57 2000
+++ src/main.c Tue Jan 25 20:32:52 2000
@@ -34,7 +34,7 @@
#include <version.h>
#include <term.h>
-void main(int argc, const char *argv[])
+int main(int argc, const char *argv[])
{
char *p;

37
korean/han/files/patch-bd Normal file
View file

@ -0,0 +1,37 @@
--- src/vc.c.orig Fri Jun 9 04:14:43 2000
+++ src/vc.c Fri Jun 9 04:27:53 2000
@@ -95,28 +95,26 @@
inline void blatch(void *head, int n)
{
- __asm__("\t clc\n"
+ __asm__ volatile("\t clc\n"
"1:\n"
"\t andb %%bl, (%%eax)\n"
"\t incl %%eax\n"
"\t loop 1b\n"
- :
- : "eax" ((long)head), "bl" (0x7F), "c" (n)
- : "bl", "cx" );
+ : "=bl" (head), "=c" (n)
+ : "eax" ((long)head), "0" (0x7F), "1" (n));
}
static
inline void llatch(void *head, int n)
{
- __asm__("\t clc\n"
+ __asm__ volatile("\t clc\n"
"1:\n"
"\t andl %%ebx, (%%eax)\n"
"\t addl $4, %%eax\n"
"\t loop 1b\n"
- :
- : "eax" ((long)head), "ebx" (0x7F7F7F7F), "c" (n>>2)
- : "ebx", "cx" );
+ : "=ebx" (head), "=c" (n)
+ : "eax" ((long)head), "0" (0x7F7F7F7F), "1" (n>>2));
}
static inline u_int TextAddress(u_int x, u_int y)

12
korean/han/files/patch-be Normal file
View file

@ -0,0 +1,12 @@
--- src/mouse.c.orig Mon Jan 27 20:40:27 1997
+++ src/mouse.c Tue May 9 18:08:44 2000
@@ -176,7 +176,8 @@
mouseType = MOUSE_NONE;
mInfo.has_mouse = FALSE;
- sscanf(config, "%s", name);
+ strncpy(name, config, MAX_COLS - 1);
+ name[MAX_COLS - 1] = '\0';
for (p = mice; p->name != NULL; p++) {
if (strcasecmp(name, p->name) == 0) {
mouseType = p->type;

View file

@ -1,17 +1,17 @@
Han-1.0fb
---------
HAN
---
HAN is a hangul console. This is an alpha version. Supported video card is
VGA only, and, supported font are Minix/V and BDF. This program requires
shared memory.
shared memory. HAN is derived from KON, a Kanji COnsole for Linux/FreeBSD.
This version supports ko_KR.euc.
Orignal kon written by manabe@papilio.tutics.tut.ac.jp.
FreeBSD port of kon is done by ogura@st.rim.or.jp.
Han written by nsroh@juno.kaist.ac.kr, hanmaum@baram.kaist.ac.kr.
FreeBSD port of han is done by yujeny@pandora.snu.ac.kr.
HAN written by nsroh@juno.kaist.ac.kr, hanmaum@baram.kaist.ac.kr.
FreeBSD port of HAN is done by yujeny@pandora.snu.ac.kr & cjh@FreeBSD.org.
--
Port by Choi Jun Ho <junker@jazz.snu.ac.kr>
CHOI Junho <cjh@FreeBSD.org>