diff options
author | daichi <daichi@FreeBSD.org> | 2012-05-10 03:28:24 +0800 |
---|---|---|
committer | daichi <daichi@FreeBSD.org> | 2012-05-10 03:28:24 +0800 |
commit | b8a99dfaf5804fac88fe55b75ad27f72d6aa275d (patch) | |
tree | 674b42f56e4908d9ba4db5cd1633a4d1fda6ea0a /japanese | |
parent | 9ca73c7c5209f8be1a5571ca855bea8f04f37a07 (diff) | |
download | freebsd-ports-gnome-b8a99dfaf5804fac88fe55b75ad27f72d6aa275d.tar.gz freebsd-ports-gnome-b8a99dfaf5804fac88fe55b75ad27f72d6aa275d.tar.zst freebsd-ports-gnome-b8a99dfaf5804fac88fe55b75ad27f72d6aa275d.zip |
- fixed the building on amd64
- fixed the building on 9+
- clean-up patches
PR: 167724
Submitted by: Masamichi Takatsu <taka2@doga.co.jp>
Diffstat (limited to 'japanese')
48 files changed, 1740 insertions, 1458 deletions
diff --git a/japanese/kon2-16dot/Makefile b/japanese/kon2-16dot/Makefile index 92155c598357..4dbb4c46ba9b 100644 --- a/japanese/kon2-16dot/Makefile +++ b/japanese/kon2-16dot/Makefile @@ -7,7 +7,7 @@ PORTNAME= kon2 PORTVERSION= 0.3 -PORTREVISION= 4 +PORTREVISION= 5 # '+=' is for slave ports CATEGORIES+= japanese MASTER_SITES= ${MASTER_SITE_PORTS_JP} @@ -22,7 +22,7 @@ EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} MAINTAINER?= ports@FreeBSD.org COMMENT= Kanji On Console -- Display kanji characters on your own console -ONLY_FOR_ARCHS= i386 +ONLY_FOR_ARCHS= i386 amd64 MAN1= kon.1 MANLANG= ja @@ -32,10 +32,6 @@ DOCDIR= ${PREFIX}/share/doc/kon2 .include <bsd.port.pre.mk> -.if ${OSVERSION} > 900007 -BROKEN= fails to build with new utmpx -.endif - .if !defined(KONFONT) KONFONT=16dot KON16FONT=Startup diff --git a/japanese/kon2-16dot/files/patch-ac b/japanese/kon2-16dot/files/patch-Makefile.FreeBSD index 84dcedc40a70..9566aace84c3 100644 --- a/japanese/kon2-16dot/files/patch-ac +++ b/japanese/kon2-16dot/files/patch-Makefile.FreeBSD @@ -1,5 +1,5 @@ ---- Makefile.FreeBSD.orig Thu Jan 30 10:29:44 1997 -+++ Makefile.FreeBSD Fri Apr 11 20:51:39 1997 +--- Makefile.FreeBSD.orig 1997-01-30 10:29:44.000000000 +0900 ++++ Makefile.FreeBSD 2012-05-10 00:14:28.022551143 +0900 @@ -16,7 +16,6 @@ @echo \#define VERSION \"ver.$(VERSION).`cat .VERSION` \(`date +%m/%d`\)\" > include/version.h diff --git a/japanese/kon2-16dot/files/patch-aa b/japanese/kon2-16dot/files/patch-aa deleted file mode 100644 index 41fa87399c62..000000000000 --- a/japanese/kon2-16dot/files/patch-aa +++ /dev/null @@ -1,126 +0,0 @@ ---- src/vc.c.orig Sat Jan 25 00:06:23 1997 -+++ src/vc.c Sun Sep 19 04:39:05 2004 -@@ -40,7 +40,13 @@ - #include <termio.h> - #elif defined(__FreeBSD__) - #include <termios.h> --#include <machine/console.h> -+#include <osreldate.h> -+#if __FreeBSD_version >= 410000 -+# include <sys/consio.h> -+# include <sys/kbio.h> -+#else -+# include <machine/console.h> -+#endif - #endif - #include <sys/ioctl.h> - #ifdef linux -@@ -94,29 +100,22 @@ - static - inline void blatch(void *head, int n) - { -- -- __asm__("\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" ); -+ char *tmp = (char *)head; -+ do { -+ *tmp &= 0x7f; -+ tmp++; -+ } while( --n ); - } - - static - inline void llatch(void *head, int n) - { -- -- __asm__("\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" ); -+ int *tmp = (int *)head; -+ n /= 4; -+ do { -+ *tmp &= 0x7f7f7f7f; -+ tmp++; -+ } while( --n ); - } - - static inline u_int TextAddress(u_int x, u_int y) -@@ -266,12 +265,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); -@@ -297,6 +307,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) -@@ -816,21 +829,31 @@ - - static int ConfigBeep(const char *confstr) - { -- beepCount = atoi(confstr) * 10000; - #if defined(linux) -+ 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 || beepCount <= 0) return; - #if defined(linux) -+ if (!con.active || beepCount <= 0) 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 - } - diff --git a/japanese/kon2-16dot/files/patch-ab b/japanese/kon2-16dot/files/patch-ab deleted file mode 100644 index 7e9ce7fe6ffd..000000000000 --- a/japanese/kon2-16dot/files/patch-ab +++ /dev/null @@ -1,43 +0,0 @@ ---- src/child.c.orig Fri Jan 24 09:36:14 1997 -+++ src/child.c Sat Apr 26 05:45:25 1997 -@@ -31,6 +31,7 @@ - #include <unistd.h> - #ifdef __FreeBSD__ - #include <errno.h> -+#include <sys/ioctl.h> - #endif - - #include <getcap.h> -@@ -87,6 +88,9 @@ - { - char *shell, *tail, *tcap; - char buff[80]; -+#if defined(__FreeBSD__) -+ struct winsize win; -+#endif - - setgid(getgid()); - setuid(getuid()); -@@ -97,6 +101,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 - -@@ -107,7 +115,11 @@ - printf("\rKON2 Kanji On Console " VERSION - " using VT number %c\r\n" - "%*s\r\n" -+#if defined(__FreeBSD__) -+ "%*s\r\n", *(ttyname(fileno(errfp))+9), -+#else /* linux */ - "%*s\r\n", *(ttyname(fileno(errfp))+8), -+#endif - dInfo.txmax, - "Copyright (C) " - "1993-1996 Takashi MANABE", diff --git a/japanese/kon2-16dot/files/patch-ae b/japanese/kon2-16dot/files/patch-ae deleted file mode 100644 index 1ae00152e903..000000000000 --- a/japanese/kon2-16dot/files/patch-ae +++ /dev/null @@ -1,14 +0,0 @@ ---- doc/kon.1~ Thu Sep 5 09:13:47 1996 -+++ doc/kon.1 Sat Apr 12 21:35:48 1997 -@@ -267,9 +267,9 @@ - .SH 【ファイル】 - .if n .ta 2.5i - .if t .ta 1.8i --/usr/local/lib/kon.cfg 環境設定ファイル -+@@PREFIX@@/etc/kon.cfg 環境設定ファイル - .br --/usr/lib/font/* フォントファイル -+@@PREFIX@@/share/fonts/bdf/* フォントファイル - .SH 【関連項目】 - swkon(1), fld(1) - .SH 【注意事項】 diff --git a/japanese/kon2-16dot/files/patch-af b/japanese/kon2-16dot/files/patch-af deleted file mode 100644 index c115d016f6ba..000000000000 --- a/japanese/kon2-16dot/files/patch-af +++ /dev/null @@ -1,68 +0,0 @@ ---- src/term.c.orig Sat Jan 25 00:03:58 1997 -+++ src/term.c Sun Sep 19 05:01:34 2004 -@@ -33,7 +33,13 @@ - #include <termio.h> - #elif defined(__FreeBSD__) - #include <termios.h> --#include <machine/console.h> -+#include <osreldate.h> -+#if __FreeBSD_version >= 410000 -+# include <sys/consio.h> -+# include <sys/kbio.h> -+#else -+# include <machine/console.h> -+#endif - #define termio termios - #endif - #include <signal.h> -@@ -201,11 +207,14 @@ - } - if (FD_ISSET(0, &readFds)) { - i = read(0, buff, BUFSIZ); -+#if defined(__FreeBSD__) -+ i = cons25tovt100(buff, i, BUFSIZ); -+#endif - if (i > 0) write(masterPty, buff, i); - 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); -@@ -449,11 +458,18 @@ - PerrorExit("/dev/console"); - } - #elif defined(__FreeBSD__) -+#if __FreeBSD_version >= 501100 -+ cfd = open("/dev/ttyv0", O_WRONLY); -+ if (cfd < 0 && (cfd = open("/dev/ttyv0", O_RDONLY)) < 0) { -+ PerrorExit("/dev/ttyv0"); -+ } -+#else - cfd = open("/dev/vga", O_WRONLY); - if (cfd < 0 && (cfd = open("/dev/vga", O_RDONLY)) < 0) { - PerrorExit("/dev/vga"); - } - #endif -+#endif - ioctl(cfd, VT_ACTIVATE, orgVtNum); - close(cfd); - } -@@ -471,9 +487,15 @@ - if (cfd < 0 && (cfd = open("/dev/console", O_RDONLY)) < 0) - fatal("can't open /dev/console"); - #elif defined(__FreeBSD__) -+#if __FreeBSD_version >= 501100 -+ cfd = open("/dev/ttyv0", O_WRONLY); -+ if (cfd < 0 && (cfd = open("/dev/ttyv0", O_RDONLY)) < 0) -+ fatal("can't open /dev/ttyv0"); -+#else - cfd = open("/dev/vga", O_WRONLY); - if (cfd < 0 && (cfd = open("/dev/vga", O_RDONLY)) < 0) - fatal("can't open /dev/vga"); -+#endif - #endif - ioctl(cfd, KDGETMODE, &mode); - if (mode == KD_TEXT) { diff --git a/japanese/kon2-16dot/files/patch-ah b/japanese/kon2-16dot/files/patch-ah deleted file mode 100644 index e410e32bf9d9..000000000000 --- a/japanese/kon2-16dot/files/patch-ah +++ /dev/null @@ -1,38 +0,0 @@ ---- src/display/vga.c.orig Sun Jan 26 18:05:00 1997 -+++ src/display/vga.c Wed Jan 24 00:05:00 2001 -@@ -47,7 +47,13 @@ - #elif defined(__FreeBSD__) - #include <vm/vm_param.h> - #include <sys/ioctl.h> --#include <machine/console.h> -+#include <osreldate.h> -+#if __FreeBSD_version >= 410000 -+# include <sys/consio.h> -+# include <sys/kbio.h> -+#else -+# include <machine/console.h> -+#endif - vm_size_t page_size; - #endif - #undef free -@@ -382,7 +388,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; -@@ -620,7 +626,11 @@ - Perror("ioctl CONSOLE_IO_ENABLE"); - 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; - } diff --git a/japanese/kon2-16dot/files/patch-aj b/japanese/kon2-16dot/files/patch-aj deleted file mode 100644 index a1c3a1493e52..000000000000 --- a/japanese/kon2-16dot/files/patch-aj +++ /dev/null @@ -1,5 +0,0 @@ ---- include/version.h.orig Sat Aug 7 05:04:19 1999 -+++ include/version.h Sat Aug 7 05:04:26 1999 -@@ -1 +1 @@ --#define VERSION "ver.0.3 (01/28)" -+#define VERSION "ver.0.3 (1998/10/31)" diff --git a/japanese/kon2-16dot/files/patch-ak b/japanese/kon2-16dot/files/patch-ak deleted file mode 100644 index bd724bb48035..000000000000 --- a/japanese/kon2-16dot/files/patch-ak +++ /dev/null @@ -1,25 +0,0 @@ ---- 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)\ - {\ diff --git a/japanese/kon2-16dot/files/patch-al b/japanese/kon2-16dot/files/patch-al deleted file mode 100644 index 5555214c56d5..000000000000 --- a/japanese/kon2-16dot/files/patch-al +++ /dev/null @@ -1,159 +0,0 @@ ---- 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 diff --git a/japanese/kon2-16dot/files/patch-ba b/japanese/kon2-16dot/files/patch-ba deleted file mode 100644 index f47facb6fe2f..000000000000 --- a/japanese/kon2-16dot/files/patch-ba +++ /dev/null @@ -1,35 +0,0 @@ -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 diff --git a/japanese/kon2-16dot/files/patch-bb b/japanese/kon2-16dot/files/patch-bb deleted file mode 100644 index fc703b8536b0..000000000000 --- a/japanese/kon2-16dot/files/patch-bb +++ /dev/null @@ -1,19 +0,0 @@ -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) - { diff --git a/japanese/kon2-16dot/files/patch-bc b/japanese/kon2-16dot/files/patch-bc deleted file mode 100644 index 7cba6bf48f5f..000000000000 --- a/japanese/kon2-16dot/files/patch-bc +++ /dev/null @@ -1,12 +0,0 @@ -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; - diff --git a/japanese/kon2-16dot/files/patch-be b/japanese/kon2-16dot/files/patch-be deleted file mode 100644 index e85ef0e9a9a0..000000000000 --- a/japanese/kon2-16dot/files/patch-be +++ /dev/null @@ -1,12 +0,0 @@ ---- 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; diff --git a/japanese/kon2-16dot/files/patch-ai b/japanese/kon2-16dot/files/patch-doc_CHANGES index 5b6fec58a151..e446351b81d6 100644 --- a/japanese/kon2-16dot/files/patch-ai +++ b/japanese/kon2-16dot/files/patch-doc_CHANGES @@ -1,5 +1,5 @@ ---- doc/CHANGES.orig Sat Aug 7 05:03:30 1999 -+++ doc/CHANGES Sat Aug 7 05:03:34 1999 +--- doc/CHANGES.orig 1997-02-06 09:58:16.000000000 +0900 ++++ doc/CHANGES 2012-05-10 00:14:28.145552672 +0900 @@ -128,3 +128,9 @@ FreeBSD での kon.cfg, kon のインストール時のパーミッション修正 KON2 0.3(97/2/06) manabe@dsl.ics.tut.ac.jp diff --git a/japanese/kon2-16dot/files/patch-doc_kon.1 b/japanese/kon2-16dot/files/patch-doc_kon.1 new file mode 100644 index 000000000000..6ae46ccc2db8 --- /dev/null +++ b/japanese/kon2-16dot/files/patch-doc_kon.1 @@ -0,0 +1,49 @@ +--- doc/kon.1.orig 1996-09-05 09:13:47.000000000 +0900 ++++ doc/kon.1 2012-05-10 00:17:11.688553415 +0900 +@@ -11,6 +11,18 @@ + .B -capability + value ... + ] ++.br ++.B kon ++[ ++.B -s ++] ++[ ++.B -e ++command argument ... ++] ++[ ++.B -u ++] + .SH 【概要】 + \fIKON\fP は \fILinux\fP, \fIFreeBSD\fP のコンソール画面上で漢字を表示 + するためのプログラムです。\fIKON\fP では、 +@@ -36,6 +48,15 @@ + + とすれば \fICursorInterval\fP の値を 10 にして起動します。 + ++.B -s ++シングルユーザモードで使用します。 ++ ++.B -e ++コマンドを起動するとき、使用します。この引数以降は、コマンド名とその引数と ++見なされます。 ++ ++.B -u ++TERM 環境変数を vt100 に設定しません。デフォルトは、vt100 に設定します。 + .PP + .SH 【環境設定】 + 表示するビデオドライバやパレットなどの環境は \fIkon.cfg\fP ファイルで設定する +@@ -267,9 +288,9 @@ + .SH 【ファイル】 + .if n .ta 2.5i + .if t .ta 1.8i +-/usr/local/lib/kon.cfg 環境設定ファイル ++@@PREFIX@@/etc/kon.cfg 環境設定ファイル + .br +-/usr/lib/font/* フォントファイル ++@@PREFIX@@/share/fonts/bdf/* フォントファイル + .SH 【関連項目】 + swkon(1), fld(1) + .SH 【注意事項】 diff --git a/japanese/kon2-16dot/files/patch-font::Makefile.FreeBSD b/japanese/kon2-16dot/files/patch-font::Makefile.FreeBSD deleted file mode 100644 index 338d62c6dfac..000000000000 --- a/japanese/kon2-16dot/files/patch-font::Makefile.FreeBSD +++ /dev/null @@ -1,10 +0,0 @@ ---- font/Makefile.FreeBSD.orig Sat Jan 25 19:08:44 1997 -+++ font/Makefile.FreeBSD Fri Dec 24 11:46:26 2004 -@@ -11,6 +11,7 @@ - .endif - - PROG= fld -+NO_MAN= yes - - .if exists(${.OBJDIR}/../lib) - LIBOBJ= -L${.OBJDIR}/../lib diff --git a/japanese/kon2-16dot/files/patch-font_Makefile.FreeBSD b/japanese/kon2-16dot/files/patch-font_Makefile.FreeBSD new file mode 100644 index 000000000000..a054705ae737 --- /dev/null +++ b/japanese/kon2-16dot/files/patch-font_Makefile.FreeBSD @@ -0,0 +1,10 @@ +--- font/Makefile.FreeBSD.orig 1997-01-25 19:08:44.000000000 +0900 ++++ font/Makefile.FreeBSD 2012-05-10 00:14:28.693551770 +0900 +@@ -11,6 +11,7 @@ + .endif + + PROG= fld ++NO_MAN= yes + + .if exists(${.OBJDIR}/../lib) + LIBOBJ= -L${.OBJDIR}/../lib diff --git a/japanese/kon2-16dot/files/patch-font_fld.c b/japanese/kon2-16dot/files/patch-font_fld.c index 3052e294ef8f..6db35f661d5e 100644 --- a/japanese/kon2-16dot/files/patch-font_fld.c +++ b/japanese/kon2-16dot/files/patch-font_fld.c @@ -1,74 +1,74 @@ - --- font/fld.c 30 Sep 2008 08:02:59 -0000 1.1.1.1 - +++ font/fld.c 23 Oct 2008 09:24:33 -0000 - @@ -52,36 +52,13 @@ - {NULL, NULL} - }; - - -void UnloadShmem(char fnum) - -{ - - key_t shmkey; - - int shmid; - - struct shmid_ds shmseg; - - - -#if defined(linux) - - shmkey = ftok(CONFIG_NAME, fnum); - -#elif defined(__FreeBSD__) - - shmkey = 5000 + (fnum & 0x7F); - -#endif - - if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0) - - return; - - shmctl(shmid, IPC_STAT, &shmseg); - - if (shmseg.shm_nattch < 1) { - - shmctl(shmid, IPC_RMID, 0); - - } - -} - - - int CheckLoadedFont(char fnum) - { - key_t shmkey; - extern int forceLoad; - - if (forceLoad) return(EOF); - -#if defined(linux) - - shmkey = ftok(SHMEM_NAME, fnum); - -#elif defined(__FreeBSD__) - - shmkey = 5000 + (fnum & 0x7F); - -#endif - + shmkey = ftok(CONFIG_NAME, fnum); - if (shmget(shmkey, 1, 0444) == EOF) return(EOF); - return(0); - } - @@ -93,11 +70,7 @@ - int shmid; - u_char *shmbuff; - - -#if defined(linux) - - shmkey = ftok(SHMEM_NAME, fi->type); - -#elif defined(__FreeBSD__) - - shmkey = 5000 + (fi->type & 0x0000007F); - -#endif - + shmkey = ftok(CONFIG_NAME, fi->type); - shmid = shmget(shmkey, fi->size+sizeof(struct fontInfo), - IPC_CREAT|0666); - shmbuff = shmat(shmid, 0, 0); - @@ -134,11 +107,7 @@ - int shmid; - struct fontInfo *fi; - - -#if defined(linux) - shmkey = ftok(CONFIG_NAME, fnum); - -#elif defined(__FreeBSD__) - - shmkey = 5000 + (fnum & 0x7F); - -#endif - if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0) - return(0); - fi = (struct fontInfo*)shmat(shmid, 0, SHM_RDONLY); - @@ -194,7 +163,7 @@ - (n & CHR_DBC) ? - fDRegs[n&~CHR_DFLD].registry: - fSRegs[n&~CHR_SFLD].registry); - - UnloadShmem(n | CHR_SFLD); - + DownShmem(n | CHR_SFLD); - break; - } - st = ST_ARG; +--- font/fld.c.orig 1997-01-24 02:17:32.000000000 +0900 ++++ font/fld.c 2012-05-10 00:14:28.706551665 +0900 +@@ -52,36 +52,13 @@ + {NULL, NULL} + }; + +-void UnloadShmem(char fnum) +-{ +- key_t shmkey; +- int shmid; +- struct shmid_ds shmseg; +- +-#if defined(linux) +- shmkey = ftok(CONFIG_NAME, fnum); +-#elif defined(__FreeBSD__) +- shmkey = 5000 + (fnum & 0x7F); +-#endif +- if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0) +- return; +- shmctl(shmid, IPC_STAT, &shmseg); +- if (shmseg.shm_nattch < 1) { +- shmctl(shmid, IPC_RMID, 0); +- } +-} +- + int CheckLoadedFont(char fnum) + { + key_t shmkey; + extern int forceLoad; + + if (forceLoad) return(EOF); +-#if defined(linux) +- shmkey = ftok(SHMEM_NAME, fnum); +-#elif defined(__FreeBSD__) +- shmkey = 5000 + (fnum & 0x7F); +-#endif ++ shmkey = ftok(CONFIG_NAME, fnum); + if (shmget(shmkey, 1, 0444) == EOF) return(EOF); + return(0); + } +@@ -93,11 +70,7 @@ + int shmid; + u_char *shmbuff; + +-#if defined(linux) +- shmkey = ftok(SHMEM_NAME, fi->type); +-#elif defined(__FreeBSD__) +- shmkey = 5000 + (fi->type & 0x0000007F); +-#endif ++ shmkey = ftok(CONFIG_NAME, fi->type); + shmid = shmget(shmkey, fi->size+sizeof(struct fontInfo), + IPC_CREAT|0666); + shmbuff = shmat(shmid, 0, 0); +@@ -134,11 +107,7 @@ + int shmid; + struct fontInfo *fi; + +-#if defined(linux) + shmkey = ftok(CONFIG_NAME, fnum); +-#elif defined(__FreeBSD__) +- shmkey = 5000 + (fnum & 0x7F); +-#endif + if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0) + return(0); + fi = (struct fontInfo*)shmat(shmid, 0, SHM_RDONLY); +@@ -194,7 +163,7 @@ + (n & CHR_DBC) ? + fDRegs[n&~CHR_DFLD].registry: + fSRegs[n&~CHR_SFLD].registry); +- UnloadShmem(n | CHR_SFLD); ++ DownShmem(n | CHR_SFLD); + break; + } + st = ST_ARG; diff --git a/japanese/kon2-16dot/files/patch-font_fontx2.c b/japanese/kon2-16dot/files/patch-font_fontx2.c index 0acd90f49c0c..a8335b8ae7b0 100644 --- a/japanese/kon2-16dot/files/patch-font_fontx2.c +++ b/japanese/kon2-16dot/files/patch-font_fontx2.c @@ -1,19 +1,19 @@ - --- font/fontx2.c 30 Sep 2008 08:02:59 -0000 1.1.1.1 - +++ font/fontx2.c 23 Oct 2008 09:24:33 -0000 - @@ -37,6 +37,7 @@ - #include <string.h> - #include <sys/socket.h> - - +#include <defs.h> - #include <interface.h> - #include <fnld.h> - - @@ -170,7 +171,7 @@ - font = FontLoadSFontx(fp, header); - else exit(0); - } - - free(header); - + SafeFree(header); - return(font); - } - +--- font/fontx2.c.orig 1997-01-24 19:08:56.000000000 +0900 ++++ font/fontx2.c 2012-05-10 00:14:28.719647899 +0900 +@@ -37,6 +37,7 @@ + #include <string.h> + #include <sys/socket.h> + ++#include <defs.h> + #include <interface.h> + #include <fnld.h> + +@@ -170,7 +171,7 @@ + font = FontLoadSFontx(fp, header); + else exit(0); + } +- free(header); ++ SafeFree(header); + return(font); + } + diff --git a/japanese/kon2-16dot/files/patch-font_minix.c b/japanese/kon2-16dot/files/patch-font_minix.c new file mode 100644 index 000000000000..b0a90de42b4e --- /dev/null +++ b/japanese/kon2-16dot/files/patch-font_minix.c @@ -0,0 +1,11 @@ +--- font/minix.c.orig 1997-01-24 19:09:59.000000000 +0900 ++++ font/minix.c 2012-05-10 00:17:11.703557005 +0900 +@@ -62,7 +62,7 @@ + unsigned short end_code; + char _unused[502]; /* empty */ + char memo[FH_MEMO_SIZE]; +- long sum; ++ int sum; + }; + + #define FONT_HEAD_SIZE sizeof(struct font_header) diff --git a/japanese/kon2-16dot/files/patch-include_defs.h b/japanese/kon2-16dot/files/patch-include_defs.h index 62e6fa1ecaec..2cf8f86586dd 100644 --- a/japanese/kon2-16dot/files/patch-include_defs.h +++ b/japanese/kon2-16dot/files/patch-include_defs.h @@ -1,9 +1,9 @@ - --- include/defs.h 30 Sep 2008 08:02:59 -0000 1.1.1.1 - +++ include/defs.h 23 Oct 2008 09:27:32 -0000 - @@ -37,4 +37,6 @@ - #define FAILURE (-1) - #define SUCCESS (0) - - +#define SafeFree(x) do { if ((x) != NULL) free(x), (x) = NULL; } while (0) - + - #endif +--- include/defs.h.orig 1997-01-24 16:04:32.000000000 +0900 ++++ include/defs.h 2012-05-10 00:14:28.733561206 +0900 +@@ -37,4 +37,6 @@ + #define FAILURE (-1) + #define SUCCESS (0) + ++#define SafeFree(x) do { if ((x) != NULL) free(x), (x) = NULL; } while (0) ++ + #endif diff --git a/japanese/kon2-16dot/files/patch-include_fnld.h b/japanese/kon2-16dot/files/patch-include_fnld.h index 1ccf63250a95..78fbe909b8fe 100644 --- a/japanese/kon2-16dot/files/patch-include_fnld.h +++ b/japanese/kon2-16dot/files/patch-include_fnld.h @@ -1,13 +1,13 @@ - --- include/fnld.h 30 Sep 2008 08:02:59 -0000 1.1.1.1 - +++ include/fnld.h 23 Oct 2008 09:24:33 -0000 - @@ -51,6 +51,10 @@ - #define FR_ATTACH 1 - #define FR_PROXY 2 - - +#if defined(__FreeBSD__) - +#define ftok(p, n) (5000 + ((n) & 0x7F)) - +#endif - + - extern struct fontRegs fSRegs[], fDRegs[]; - extern struct fontRegs *sbFReg, *dbFReg; - +--- include/fnld.h.orig 1997-01-24 16:04:58.000000000 +0900 ++++ include/fnld.h 2012-05-10 00:14:28.746555141 +0900 +@@ -51,6 +51,10 @@ + #define FR_ATTACH 1 + #define FR_PROXY 2 + ++#if defined(__FreeBSD__) ++#define ftok(p, n) (5000 + ((n) & 0x7F)) ++#endif ++ + extern struct fontRegs fSRegs[], fDRegs[]; + extern struct fontRegs *sbFReg, *dbFReg; + diff --git a/japanese/kon2-16dot/files/patch-include_mem.h b/japanese/kon2-16dot/files/patch-include_mem.h index c94dba660faa..308d713a16ad 100644 --- a/japanese/kon2-16dot/files/patch-include_mem.h +++ b/japanese/kon2-16dot/files/patch-include_mem.h @@ -1,9 +1,34 @@ - --- include/mem.h 30 Sep 2008 08:09:55 -0000 1.1.1.2 - +++ include/mem.h 23 Oct 2008 09:24:33 -0000 - @@ -111,6 +111,5 @@ - extern void wmove(void *, void *, int); - extern void lmove(void *, void *, int); - #endif - -extern void SafeFree(void **); - - #endif +--- include/mem.h.orig 1997-01-24 16:06:22.000000000 +0900 ++++ include/mem.h 2012-05-10 00:14:28.759551808 +0900 +@@ -46,6 +46,7 @@ + "d" ((u_short) port)); + } + ++#if 0 + static inline + void lzero(void *head, int n) + { +@@ -93,11 +94,22 @@ + "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); +-extern void SafeFree(void **); ++#endif + + #endif diff --git a/japanese/kon2-16dot/files/patch-include_term.h b/japanese/kon2-16dot/files/patch-include_term.h index 69875c0b24cf..46fac83ae6dd 100644 --- a/japanese/kon2-16dot/files/patch-include_term.h +++ b/japanese/kon2-16dot/files/patch-include_term.h @@ -1,9 +1,9 @@ - --- include/term.h 30 Sep 2008 08:02:59 -0000 1.1.1.1 - +++ include/term.h 23 Oct 2008 09:24:33 -0000 - @@ -36,5 +36,6 @@ - extern void TermStart(void); /* start procesing */ - extern void TermRestart(int fd); /* restart kon (args are read from fd) */ - extern int masterPty; /* master pseudo-tty file descriptor */ - +extern int TermGetNumber(void); - - #endif +--- include/term.h.orig 1997-01-24 16:07:18.000000000 +0900 ++++ include/term.h 2012-05-10 00:14:28.771576381 +0900 +@@ -36,5 +36,6 @@ + extern void TermStart(void); /* start procesing */ + extern void TermRestart(int fd); /* restart kon (args are read from fd) */ + extern int masterPty; /* master pseudo-tty file descriptor */ ++extern int TermGetNumber(void); + + #endif diff --git a/japanese/kon2-16dot/files/patch-include_version.h b/japanese/kon2-16dot/files/patch-include_version.h new file mode 100644 index 000000000000..220adede13c9 --- /dev/null +++ b/japanese/kon2-16dot/files/patch-include_version.h @@ -0,0 +1,5 @@ +--- include/version.h.orig 1997-01-30 10:30:50.000000000 +0900 ++++ include/version.h 2012-05-10 00:14:28.566551540 +0900 +@@ -1 +1 @@ +-#define VERSION "ver.0.3 (01/28)" ++#define VERSION "ver.0.3 (1998/10/31)" diff --git a/japanese/kon2-16dot/files/patch-am b/japanese/kon2-16dot/files/patch-include_vga.h index 89c19f5d9b1c..67fe680c8a97 100644 --- a/japanese/kon2-16dot/files/patch-am +++ b/japanese/kon2-16dot/files/patch-include_vga.h @@ -1,5 +1,5 @@ ---- include/vga.h.orig Fri Jan 24 16:08:01 1997 -+++ include/vga.h Mon Jan 31 14:13:08 2000 +--- include/vga.h.orig 1997-01-24 16:08:01.000000000 +0900 ++++ include/vga.h 2012-05-10 00:14:28.621553061 +0900 @@ -59,7 +59,11 @@ #if defined(linux) #define GRAPH_BASE 0xA0000 diff --git a/japanese/kon2-16dot/files/patch-include_vt.h b/japanese/kon2-16dot/files/patch-include_vt.h index a8cf30edfbb3..39c92d4cf7af 100644 --- a/japanese/kon2-16dot/files/patch-include_vt.h +++ b/japanese/kon2-16dot/files/patch-include_vt.h @@ -1,18 +1,22 @@ - --- include/vt.h 30 Sep 2008 08:09:55 -0000 1.1.1.2 - +++ include/vt.h 23 Oct 2008 09:24:33 -0000 - @@ -59,12 +59,10 @@ - ins, - active, - wrap, - -#if defined(__FreeBSD__) - - text_mode, - - cursor_key_mode; - -#else - text_mode; - -#endif - +#if defined(__FreeBSD__) - + bool cursor_key_mode; - +#endif /* __FreeBSD__ */ - }; - - extern struct _con_info con; +--- include/vt.h.orig 1997-01-24 16:08:13.000000000 +0900 ++++ include/vt.h 2012-05-10 00:14:28.784553183 +0900 +@@ -60,6 +60,9 @@ + active, + wrap, + text_mode; ++#if defined(__FreeBSD__) ++ bool cursor_key_mode; ++#endif /* __FreeBSD__ */ + }; + + extern struct _con_info con; +@@ -75,6 +78,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)\ + {\ diff --git a/japanese/kon2-16dot/files/patch-ad b/japanese/kon2-16dot/files/patch-kon.cfg.FreeBSD index 96f2563c544a..5e1500dc835d 100644 --- a/japanese/kon2-16dot/files/patch-ad +++ b/japanese/kon2-16dot/files/patch-kon.cfg.FreeBSD @@ -1,12 +1,13 @@ ---- kon.cfg.FreeBSD.orig Fri Jan 24 02:17:34 1997 -+++ kon.cfg.FreeBSD Wed Sep 2 22:24:15 1998 -@@ -115,8 +115,11 @@ +--- kon.cfg.FreeBSD.orig 1997-01-24 02:17:34.000000000 +0900 ++++ kon.cfg.FreeBSD 2012-05-10 00:14:28.042552343 +0900 +@@ -114,9 +114,12 @@ + 63 63 63 # Startup command definition (usually font loading commands are specified) -bdf-zcat:Startup -+bdf-zcat16:@@KON16FONT@@ - gzip -cd /usr/local/lib/fonts/k14.bdf.gz | /usr/local/bin/fld -t bdf -n - gzip -cd /usr/local/lib/fonts/7x14rk.bdf.gz | /usr/local/bin/fld -t bdf -n ++bdf-zcat16:@@KON16FONT@@ + gzip -cd @@PREFIX@@/share/fonts/bdf/jiskan16.bdf.gz | /usr/local/bin/fld -t bdf -n + gzip -cd @@PREFIX@@/share/fonts/bdf/8x16rk.bdf.gz | /usr/local/bin/fld -t bdf -n +bdf-zcat14:@@KON14FONT@@ @@ -15,7 +16,7 @@ minix: /usr/bin/fld.minix -n /usr/share/fonts/publicfont.ank /usr/bin/fld.minix -n /usr/share/fonts/publicfont.k14 -@@ -143,13 +143,13 @@ +@@ -143,13 +146,13 @@ # Mouse type definition. Choose one of: Microsoft, # MouseSystems, BusMouse, MMSeries, Logitech, or None. Mouse: diff --git a/japanese/kon2-16dot/files/patch-lib_coding.c b/japanese/kon2-16dot/files/patch-lib_coding.c index 68f941e47480..dbb2af5f95d8 100644 --- a/japanese/kon2-16dot/files/patch-lib_coding.c +++ b/japanese/kon2-16dot/files/patch-lib_coding.c @@ -1,10 +1,10 @@ - --- lib/coding.c 30 Sep 2008 08:02:59 -0000 1.1.1.1 - +++ lib/coding.c 23 Oct 2008 09:24:33 -0000 - @@ -28,6 +28,7 @@ - #include <config.h> - - #include <stdio.h> - +#include <string.h> - #include <errno.h> - - #include <interface.h> +--- lib/coding.c.orig 1997-01-24 16:08:40.000000000 +0900 ++++ lib/coding.c 2012-05-10 00:14:28.797032559 +0900 +@@ -28,6 +28,7 @@ + #include <config.h> + + #include <stdio.h> ++#include <string.h> + #include <errno.h> + + #include <interface.h> diff --git a/japanese/kon2-16dot/files/patch-lib_font.c b/japanese/kon2-16dot/files/patch-lib_font.c index 1c99e014ed21..0fa97e0a42c3 100644 --- a/japanese/kon2-16dot/files/patch-lib_font.c +++ b/japanese/kon2-16dot/files/patch-lib_font.c @@ -1,26 +1,26 @@ - --- lib/font.c 30 Sep 2008 08:02:59 -0000 1.1.1.1 - +++ lib/font.c 23 Oct 2008 09:24:33 -0000 - @@ -44,11 +44,7 @@ - int shmid; - struct shmid_ds shmseg; - - -#if defined(linux) - shmkey = ftok(CONFIG_NAME, fnum); - -#elif defined(__FreeBSD__) - - shmkey = 5000 + (fnum & 0x7F); - -#endif - if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0) - return; - shmctl(shmid, IPC_STAT, &shmseg); - @@ -63,11 +59,7 @@ - key_t shmkey; - int shmid; - - -#if defined(linux) - shmkey = ftok(CONFIG_NAME, fnum); - -#elif defined(__FreeBSD__) - - shmkey = 5000 + (fnum & 0x7F); - -#endif - if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0) return(0); - return((u_char*)shmat(shmid, 0, SHM_RDONLY)); - } +--- lib/font.c.orig 1997-01-24 16:08:55.000000000 +0900 ++++ lib/font.c 2012-05-10 00:14:28.809804680 +0900 +@@ -44,11 +44,7 @@ + int shmid; + struct shmid_ds shmseg; + +-#if defined(linux) + shmkey = ftok(CONFIG_NAME, fnum); +-#elif defined(__FreeBSD__) +- shmkey = 5000 + (fnum & 0x7F); +-#endif + if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0) + return; + shmctl(shmid, IPC_STAT, &shmseg); +@@ -63,11 +59,7 @@ + key_t shmkey; + int shmid; + +-#if defined(linux) + shmkey = ftok(CONFIG_NAME, fnum); +-#elif defined(__FreeBSD__) +- shmkey = 5000 + (fnum & 0x7F); +-#endif + if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0) return(0); + return((u_char*)shmat(shmid, 0, SHM_RDONLY)); + } diff --git a/japanese/kon2-16dot/files/patch-lib_getcap.c b/japanese/kon2-16dot/files/patch-lib_getcap.c index c6e8cdce4934..2f88b1ffd390 100644 --- a/japanese/kon2-16dot/files/patch-lib_getcap.c +++ b/japanese/kon2-16dot/files/patch-lib_getcap.c @@ -1,77 +1,77 @@ - --- lib/getcap.c 30 Sep 2008 08:02:59 -0000 1.1.1.1 - +++ lib/getcap.c 23 Oct 2008 09:24:33 -0000 - @@ -73,8 +73,10 @@ - fprintf(stderr, "cap %s redefined (default %s)\r\n", name, - def_value ? def_value : "None"); - #endif - + SafeFree(cp->name); - cp->name = strdup(name); - cp->func = func; - + SafeFree(cp->def_value); - if (def_value) - cp->def_value = strdup(def_value); - return; - @@ -86,8 +88,10 @@ - fprintf(stderr, "cap %s defined (default %s)\r\n", name, - def_value ? def_value : "None"); - #endif - + SafeFree(cp->name); - cp->name = strdup(name); - cp->func = func; - + SafeFree(cp->def_value); - if (def_value) - cp->def_value = strdup(def_value); - return; - @@ -110,12 +114,9 @@ - fprintf(stderr, "cap %s deleted\r\n", cp->name); - #endif - cp->initialized = 0; - - if (cp->name) - - free(cp->name); - - if (cp->arg) - - free(cp->arg); - - if (cp->def_value) - - free(cp->def_value); - + SafeFree(cp->name); - + SafeFree(cp->arg); - + SafeFree(cp->def_value); - cp->name = cp->arg = cp->def_value = NULL; - } - } - @@ -149,10 +150,13 @@ - if ((c = FindCap(p)) != NULL) { - /* Found matching capability. Get body from file. */ - char *l = buf; - + int bnum = 0; - while (fgets(line, MAX_COLS, capFp) != NULL - && line[0] == '\t') { - char *l2 = line; - while (*l2 != '\n' && *l2 != '#') { - + if (++bnum > BUF_SIZE - 2) - + fatal("buffer overflow at configuration file\n"); - *l++ = *l2++; - } - *l++ = '\n'; - @@ -223,6 +227,7 @@ - /* Protected capability. */ - return FAILURE; - } - + SafeFree(cp->arg); - cp->arg = strdup(value); - #ifdef DEBUG - fprintf(stderr, "Setting arg for %s to %s\r\n", capName, value); - @@ -234,8 +239,12 @@ - - bool BoolConf(const char *confstr) - { - - char name[MAX_COLS]; - - sscanf(confstr, "%s", name); - + char *name, *last, *sep = " \t\r\n"; - + - + name = strtok_r((char *)confstr, sep, &last); - + if (name == NULL) - + return FALSE; - + - if (strcasecmp(name, "On") == 0 || - strcasecmp(name, "True") == 0) { - return TRUE; +--- lib/getcap.c.orig 1997-01-24 16:09:09.000000000 +0900 ++++ lib/getcap.c 2012-05-10 00:14:28.822558096 +0900 +@@ -73,8 +73,10 @@ + fprintf(stderr, "cap %s redefined (default %s)\r\n", name, + def_value ? def_value : "None"); + #endif ++ SafeFree(cp->name); + cp->name = strdup(name); + cp->func = func; ++ SafeFree(cp->def_value); + if (def_value) + cp->def_value = strdup(def_value); + return; +@@ -86,8 +88,10 @@ + fprintf(stderr, "cap %s defined (default %s)\r\n", name, + def_value ? def_value : "None"); + #endif ++ SafeFree(cp->name); + cp->name = strdup(name); + cp->func = func; ++ SafeFree(cp->def_value); + if (def_value) + cp->def_value = strdup(def_value); + return; +@@ -110,12 +114,9 @@ + fprintf(stderr, "cap %s deleted\r\n", cp->name); + #endif + cp->initialized = 0; +- if (cp->name) +- free(cp->name); +- if (cp->arg) +- free(cp->arg); +- if (cp->def_value) +- free(cp->def_value); ++ SafeFree(cp->name); ++ SafeFree(cp->arg); ++ SafeFree(cp->def_value); + cp->name = cp->arg = cp->def_value = NULL; + } + } +@@ -149,10 +150,13 @@ + if ((c = FindCap(p)) != NULL) { + /* Found matching capability. Get body from file. */ + char *l = buf; ++ int bnum = 0; + while (fgets(line, MAX_COLS, capFp) != NULL + && line[0] == '\t') { + char *l2 = line; + while (*l2 != '\n' && *l2 != '#') { ++ if (++bnum > BUF_SIZE - 2) ++ fatal("buffer overflow at configuration file\n"); + *l++ = *l2++; + } + *l++ = '\n'; +@@ -223,6 +227,7 @@ + /* Protected capability. */ + return FAILURE; + } ++ SafeFree(cp->arg); + cp->arg = strdup(value); + #ifdef DEBUG + fprintf(stderr, "Setting arg for %s to %s\r\n", capName, value); +@@ -234,8 +239,12 @@ + + bool BoolConf(const char *confstr) + { +- char name[MAX_COLS]; +- sscanf(confstr, "%s", name); ++ char *name, *last, *sep = " \t\r\n"; ++ ++ name = strtok_r((char *)confstr, sep, &last); ++ if (name == NULL) ++ return FALSE; ++ + if (strcasecmp(name, "On") == 0 || + strcasecmp(name, "True") == 0) { + return TRUE; diff --git a/japanese/kon2-16dot/files/patch-lib_mem.c b/japanese/kon2-16dot/files/patch-lib_mem.c index 8356f0f0bb9d..6a611ced9f8f 100644 --- a/japanese/kon2-16dot/files/patch-lib_mem.c +++ b/japanese/kon2-16dot/files/patch-lib_mem.c @@ -1,13 +1,23 @@ - --- lib/mem.c 30 Sep 2008 08:09:56 -0000 1.1.1.2 - +++ lib/mem.c 23 Oct 2008 09:24:33 -0000 - @@ -79,10 +79,3 @@ - } - #endif - - -void SafeFree(void **p) - -{ - - if (*p) { - - free(*p); - - *p = NULL; - - } - -} +--- lib/mem.c.orig 1997-01-25 18:11:55.000000000 +0900 ++++ lib/mem.c 2012-05-10 00:14:28.835551865 +0900 +@@ -44,6 +44,7 @@ + return(_rval); + } + ++#if 0 + void wzero(void *head, int n) + { + __asm__ ("cld\n\t" +@@ -76,11 +77,5 @@ + "S" ((long)src) + :"cx","di","si"); + } ++#endif + +-void SafeFree(void **p) +-{ +- if (*p) { +- free(*p); +- *p = NULL; +- } +-} diff --git a/japanese/kon2-16dot/files/patch-src_Makefile.FreeBSD b/japanese/kon2-16dot/files/patch-src_Makefile.FreeBSD new file mode 100644 index 000000000000..2ab0068d5140 --- /dev/null +++ b/japanese/kon2-16dot/files/patch-src_Makefile.FreeBSD @@ -0,0 +1,21 @@ +--- src/Makefile.FreeBSD.orig 1997-01-30 10:29:25.000000000 +0900 ++++ src/Makefile.FreeBSD 2012-05-10 02:50:12.820551080 +0900 +@@ -1,10 +1,17 @@ + # FreeBSD makefile for kon + # Tatsumi Hosokawa <hosokawa@jp.FreeBSD.org> + ++.include <bsd.own.mk> ++ + PROG= kon + BINOWN= root + BINMODE= 4555 +-SRCS= vt.c sock.c fnld.c vc.c mouse.c term.c main.c utmp.c errors.c child.c ++SRCS= vt.c sock.c fnld.c vc.c mouse.c term.c main.c errors.c child.c ++.if exists(${INCLUDEDIR}/utmpx.h) ++SRCS+= utmpx.c ++.else ++SRCS+= utmp.c ++.endif + LIBS+= -L${.CURDIR}/display -L${.CURDIR}/../lib -ldisplay -lgon + NOMAN= YES + CFLAGS+= -I${.CURDIR}/../include diff --git a/japanese/kon2-16dot/files/patch-src_child.c b/japanese/kon2-16dot/files/patch-src_child.c index 5140a9ef80f5..c37d4b16c527 100644 --- a/japanese/kon2-16dot/files/patch-src_child.c +++ b/japanese/kon2-16dot/files/patch-src_child.c @@ -1,92 +1,161 @@ - --- src/child.c 30 Sep 2008 08:09:56 -0000 1.1.1.2 - +++ src/child.c 23 Oct 2008 09:24:33 -0000 - @@ -40,16 +40,18 @@ - #include <version.h> - #include <vc.h> - - -static char *startupStr, *execProg; - +static char *startupStr = NULL, *execProg = NULL; - - int ConfigExecProg(const char *string) - { - + SafeFree(execProg); - execProg = strdup(string); - return SUCCESS; - } - - static int ConfigStartup(const char *string) - { - + SafeFree(startupStr); - startupStr = strdup(string); - return SUCCESS; - } - @@ -81,7 +83,8 @@ - - void ChildCleanup(void) - { - - free(startupStr); - + SafeFree(startupStr); - + SafeFree(execProg); - } - - void ChildStart(FILE *errfp) - @@ -105,46 +108,44 @@ - win.ws_col = dInfo.txmax + 1; - win.ws_xpixel = win.ws_ypixel = 0; - ioctl(STDIN_FILENO, TIOCSWINSZ, &win); - - sprintf(buff,"TERM=vt100"); - -#endif - + strcpy(buff, "TERM=vt100-color"); - +#endif /* __FreeBSD__ */ - - tcap = strdup(buff); - putenv(tcap); - - - if (startupMessage) - + if (startupMessage) { - printf("\rKON2 Kanji On Console " VERSION - - " using VT number %c\r\n" - + " using VT number %d\n" - "%*s\r\n" - -#if defined(__FreeBSD__) - - "%*s\r\n", *(ttyname(fileno(errfp))+9), - -#else /* linux */ - - "%*s\r\n", *(ttyname(fileno(errfp))+8), - -#endif - + "%*s\r\n", - + TermGetNumber(), - dInfo.txmax, - "Copyright (C) " - "1993-1996 Takashi MANABE", - dInfo.txmax, - "1993, 1994 MAEDA Atusi "); - #if defined(__FreeBSD__) - - printf("\rKON for FreeBSD-2.x ver0.01 Takashi OGURA\r\n"); - + printf("\rKON for FreeBSD-2.x ver0.01 Takashi OGURA\r\n"); - #endif - - - + } - - /* - - printf("KON using VT number %c.\n\n", - - *(ttyname(fileno(errfp))+8)); - + printf("KON using VT number %d.\n\n", TermGetNumber()); - */ - fflush(stdout); - - if (execProg) - execlp(execProg, execProg, 0); - else { - + char *ptr; - if ((execProg = getenv("SHELL")) == NULL) - execProg = "/bin/sh"; - if ((tail = rindex(execProg, '/')) == NULL) - tail = " sh"; - - sprintf(buff, "-%s", tail + 1); - - execl(execProg, buff, 0); - + ptr = strdup(tail); - + *ptr = '-'; - + execl(execProg, ptr, 0); - } - fprintf(errfp, "KON> couldn't exec shell\r\n"); - fprintf(errfp, "%s: %s\r\n", execProg, strerror(errno)); +--- src/child.c.orig 1997-01-24 09:36:14.000000000 +0900 ++++ src/child.c 2012-05-10 00:17:11.718554719 +0900 +@@ -31,6 +31,7 @@ + #include <unistd.h> + #ifdef __FreeBSD__ + #include <errno.h> ++#include <sys/ioctl.h> + #endif + + #include <getcap.h> +@@ -39,16 +40,41 @@ + #include <version.h> + #include <vc.h> + +-static char *startupStr, *execProg; ++#if defined(__FreeBSD__) ++static char *startupStr = NULL, *execProg = NULL, **execArgv = NULL; ++ ++int ConfigExecProg(const char **argv) ++{ ++ execArgv = argv; ++ SafeFree(execProg); ++ execProg = strdup(*argv); ++ return SUCCESS; ++} ++#else ++ ++static char *startupStr = NULL, *execProg = NULL; + + int ConfigExecProg(const char *string) + { ++ SafeFree(execProg); + execProg = strdup(string); + return SUCCESS; + } ++#endif ++ ++#if defined(__FreeBSD__) ++static int unset_mode = 0; /* TERM を変更しない */ ++static int vt100_mode = 0; /* vt100 または vt100-XXX */ ++ ++int ConfigUnsetTerm(const int flag) ++{ ++ unset_mode = flag; ++} ++#endif + + static int ConfigStartup(const char *string) + { ++ SafeFree(startupStr); + startupStr = strdup(string); + return SUCCESS; + } +@@ -66,7 +92,11 @@ + + static bool startupMessage; + ++#if defined(__FreeBSD__) ++int ConfigMessage(const char *confstr) ++#else + static int ConfigMessage(const char *confstr) ++#endif + { + startupMessage = BoolConf(confstr); + return SUCCESS; +@@ -80,13 +110,17 @@ + + void ChildCleanup(void) + { +- free(startupStr); ++ SafeFree(startupStr); ++ SafeFree(execProg); + } + + void ChildStart(FILE *errfp) + { + char *shell, *tail, *tcap; + char buff[80]; ++#if defined(__FreeBSD__) ++ struct winsize win; ++#endif + + setgid(getgid()); + setuid(getuid()); +@@ -96,43 +130,64 @@ + #if defined(linux) + sprintf(buff, "TERMCAP=:co#%d:li#%d:tc=console:", + dInfo.txmax + 1, dInfo.tymax + 1); +-#elif defined(__FreeBSD__) +- sprintf(buff,"TERM=vt100"); +-#endif + + tcap = strdup(buff); + putenv(tcap); ++#elif defined(__FreeBSD__) ++ if (unset_mode) { ++ if (strncmp(getenv("TERM"), "vt100", 5) == 0) { ++ vt100_mode = 1; ++ unset_mode = 0; ++ } ++ } ++ else { ++ putenv("TERM=vt100"); ++ vt100_mode = 1; ++ } ++ if (vt100_mode) { ++ win.ws_row = dInfo.tymax + 1; ++ win.ws_col = dInfo.txmax + 1; ++ win.ws_xpixel = win.ws_ypixel = 0; ++ ioctl(STDIN_FILENO, TIOCSWINSZ, &win); ++ } ++#endif + +- if (startupMessage) ++ if (startupMessage) { + printf("\rKON2 Kanji On Console " VERSION +- " using VT number %c\r\n" ++ " using VT number %d\n" + "%*s\r\n" +- "%*s\r\n", *(ttyname(fileno(errfp))+8), ++ "%*s\r\n", ++ TermGetNumber(), + dInfo.txmax, + "Copyright (C) " + "1993-1996 Takashi MANABE", + dInfo.txmax, + "1993, 1994 MAEDA Atusi "); + #if defined(__FreeBSD__) +- printf("\rKON for FreeBSD-2.x ver0.01 Takashi OGURA\r\n"); ++ printf("\rKON for FreeBSD-2.x ver0.01 Takashi OGURA\r\n"); + #endif +- ++ } + + /* +- printf("KON using VT number %c.\n\n", +- *(ttyname(fileno(errfp))+8)); ++ printf("KON using VT number %d.\n\n", TermGetNumber()); + */ + fflush(stdout); + + if (execProg) ++#if defined(__FreeBSD__) ++ execvp(execProg, execArgv); ++#else + execlp(execProg, execProg, 0); ++#endif + else { ++ char *ptr; + if ((execProg = getenv("SHELL")) == NULL) + execProg = "/bin/sh"; + if ((tail = rindex(execProg, '/')) == NULL) + tail = " sh"; +- sprintf(buff, "-%s", tail + 1); +- execl(execProg, buff, 0); ++ ptr = strdup(tail); ++ *ptr = '-'; ++ execl(execProg, ptr, 0); + } + fprintf(errfp, "KON> couldn't exec shell\r\n"); + fprintf(errfp, "%s: %s\r\n", execProg, strerror(errno)); diff --git a/japanese/kon2-16dot/files/patch-src_display_j31sx.c b/japanese/kon2-16dot/files/patch-src_display_j31sx.c index 958329a02f3b..46dea1a2071d 100644 --- a/japanese/kon2-16dot/files/patch-src_display_j31sx.c +++ b/japanese/kon2-16dot/files/patch-src_display_j31sx.c @@ -1,19 +1,19 @@ - --- src/display/j31sx.c 30 Sep 2008 08:02:59 -0000 1.1.1.1 - +++ src/display/j31sx.c 23 Oct 2008 09:24:33 -0000 - @@ -49,7 +49,6 @@ - #include <sys/mman.h> - #include <linux/mm.h> - #include <sys/kd.h> - -#undef free - #include <stdlib.h> - - #include <mem.h> - @@ -365,8 +364,6 @@ - ioperm(CGA_COLOR, 1, 0); - - munmap(gram, GRAPH_SIZE); - - - - SafeFree((void **)&gram); - } - - static struct videoInfo J31SXInfo = +--- src/display/j31sx.c.orig 1997-01-24 09:38:09.000000000 +0900 ++++ src/display/j31sx.c 2012-05-10 00:14:28.873551067 +0900 +@@ -49,7 +49,6 @@ + #include <sys/mman.h> + #include <linux/mm.h> + #include <sys/kd.h> +-#undef free + #include <stdlib.h> + + #include <mem.h> +@@ -365,8 +364,6 @@ + ioperm(CGA_COLOR, 1, 0); + + munmap(gram, GRAPH_SIZE); +- +- SafeFree((void **)&gram); + } + + static struct videoInfo J31SXInfo = diff --git a/japanese/kon2-16dot/files/patch-src_display_s3.c b/japanese/kon2-16dot/files/patch-src_display_s3.c index a8efe8d4b5fe..ff41d1d26fee 100644 --- a/japanese/kon2-16dot/files/patch-src_display_s3.c +++ b/japanese/kon2-16dot/files/patch-src_display_s3.c @@ -1,10 +1,10 @@ - --- src/display/s3.c 30 Sep 2008 08:02:59 -0000 1.1.1.1 - +++ src/display/s3.c 23 Oct 2008 09:24:33 -0000 - @@ -43,7 +43,6 @@ - #include <sys/mman.h> - #include <linux/mm.h> - #include <sys/kd.h> - -#undef free - #include <stdlib.h> - - #include <mem.h> +--- src/display/s3.c.orig 1997-01-24 09:38:24.000000000 +0900 ++++ src/display/s3.c 2012-05-10 00:14:28.885871613 +0900 +@@ -43,7 +43,6 @@ + #include <sys/mman.h> + #include <linux/mm.h> + #include <sys/kd.h> +-#undef free + #include <stdlib.h> + + #include <mem.h> diff --git a/japanese/kon2-16dot/files/patch-src_display_svga.c b/japanese/kon2-16dot/files/patch-src_display_svga.c index d8690a035d99..f62c2daec2e9 100644 --- a/japanese/kon2-16dot/files/patch-src_display_svga.c +++ b/japanese/kon2-16dot/files/patch-src_display_svga.c @@ -1,10 +1,10 @@ - --- src/display/svga.c 30 Sep 2008 08:02:59 -0000 1.1.1.1 - +++ src/display/svga.c 23 Oct 2008 09:24:33 -0000 - @@ -45,7 +45,6 @@ - /* #include <linux/mm.h> */ - #include <sys/kd.h> - #endif - -#undef free - #include <stdlib.h> - - #include <mem.h> +--- src/display/svga.c.orig 1997-01-25 17:33:29.000000000 +0900 ++++ src/display/svga.c 2012-05-10 00:14:28.898552112 +0900 +@@ -45,7 +45,6 @@ + /* #include <linux/mm.h> */ + #include <sys/kd.h> + #endif +-#undef free + #include <stdlib.h> + + #include <mem.h> diff --git a/japanese/kon2-16dot/files/patch-src_display_vga.c b/japanese/kon2-16dot/files/patch-src_display_vga.c index cc2ffe5b6fe2..d0ae78ae0aa9 100644 --- a/japanese/kon2-16dot/files/patch-src_display_vga.c +++ b/japanese/kon2-16dot/files/patch-src_display_vga.c @@ -1,25 +1,54 @@ - --- src/display/vga.c 30 Sep 2008 08:09:56 -0000 1.1.1.2 - +++ src/display/vga.c 23 Oct 2008 09:24:33 -0000 - @@ -56,7 +56,6 @@ - #endif - vm_size_t page_size; - #endif - -#undef free - #include <stdlib.h> - - #include <mem.h> - @@ -691,10 +690,9 @@ - - munmap(gramMem, dInfo.gsize); - - - SafeFree((void **)&gramMem); - - SafeFree((void **)&fontBuff1); - + SafeFree(fontBuff1); - if (savePlane3) - - SafeFree((void **)&fontBuff2); - + SafeFree(fontBuff2); - } - - /* Configure */ +--- src/display/vga.c.orig 1997-01-26 18:05:00.000000000 +0900 ++++ src/display/vga.c 2012-05-10 00:14:28.911551261 +0900 +@@ -47,10 +47,15 @@ + #elif defined(__FreeBSD__) + #include <vm/vm_param.h> + #include <sys/ioctl.h> +-#include <machine/console.h> ++#include <osreldate.h> ++#if __FreeBSD_version >= 410000 ++# include <sys/consio.h> ++# include <sys/kbio.h> ++#else ++# include <machine/console.h> ++#endif + vm_size_t page_size; + #endif +-#undef free + #include <stdlib.h> - + #include <mem.h> +@@ -382,7 +387,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; +@@ -620,7 +625,11 @@ + Perror("ioctl CONSOLE_IO_ENABLE"); + 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; + } +@@ -681,10 +690,9 @@ + + munmap(gramMem, dInfo.gsize); + +- SafeFree((void **)&gramMem); +- SafeFree((void **)&fontBuff1); ++ SafeFree(fontBuff1); + if (savePlane3) +- SafeFree((void **)&fontBuff2); ++ SafeFree(fontBuff2); + } + + /* Configure */ diff --git a/japanese/kon2-16dot/files/patch-src_errors.c b/japanese/kon2-16dot/files/patch-src_errors.c index 5c402634e313..39cb858592e2 100644 --- a/japanese/kon2-16dot/files/patch-src_errors.c +++ b/japanese/kon2-16dot/files/patch-src_errors.c @@ -1,11 +1,11 @@ - --- src/errors.c 30 Sep 2008 08:02:59 -0000 1.1.1.1 - +++ src/errors.c 23 Oct 2008 09:24:33 -0000 - @@ -48,7 +48,7 @@ - vfprintf(stderr, format, args); - } else { - VtEmu(head, strlen(head)); - - vsprintf(buf, format, args); - + vsnprintf(buf, sizeof(buf), format, args); - VtEmu(buf, strlen(buf)); - } - } +--- src/errors.c.orig 1997-01-24 09:36:22.000000000 +0900 ++++ src/errors.c 2012-05-10 00:14:28.922550440 +0900 +@@ -48,7 +48,7 @@ + vfprintf(stderr, format, args); + } else { + VtEmu(head, strlen(head)); +- vsprintf(buf, format, args); ++ vsnprintf(buf, sizeof(buf), format, args); + VtEmu(buf, strlen(buf)); + } + } diff --git a/japanese/kon2-16dot/files/patch-src::fnld.c b/japanese/kon2-16dot/files/patch-src_fnld.c index 7889619cbab4..de84d2892b2b 100644 --- a/japanese/kon2-16dot/files/patch-src::fnld.c +++ b/japanese/kon2-16dot/files/patch-src_fnld.c @@ -1,5 +1,5 @@ ---- src/fnld.c.orig Fri Jan 24 09:36:30 1997 -+++ src/fnld.c Sun Sep 19 04:10:25 2004 +--- src/fnld.c.orig 1997-01-24 09:36:30.000000000 +0900 ++++ src/fnld.c 2012-05-10 00:14:28.847552685 +0900 @@ -42,7 +42,7 @@ struct fontRegs *dbFReg, *sbFReg; diff --git a/japanese/kon2-16dot/files/patch-src_main.c b/japanese/kon2-16dot/files/patch-src_main.c index bd2aca5e612d..4207036f71b1 100644 --- a/japanese/kon2-16dot/files/patch-src_main.c +++ b/japanese/kon2-16dot/files/patch-src_main.c @@ -1,56 +1,58 @@ - --- src/main.c 30 Sep 2008 08:09:56 -0000 1.1.1.2 - +++ src/main.c 23 Oct 2008 09:24:33 -0000 - @@ -29,11 +29,45 @@ - #include <stdlib.h> - #include <unistd.h> - - +#if defined(__FreeBSD__) - +#include <err.h> - +#include <osreldate.h> - +#if __FreeBSD_version >= 410000 - +# include <sys/consio.h> - +# include <sys/kbio.h> - +#else - +# include <machine/console.h> - +#endif - +#endif /* __FreeBSD__ */ - + - #include <getcap.h> - - #include <version.h> - #include <term.h> - - +/* handler for atexit() */ - +static void - +reset_text_mode(void) - +{ - + int mode; - + - +#if defined(__FreeBSD__) - + if (ioctl(0, KDGETMODE, &mode) == -1) - + warn("ioctl(0, KDGETMODE)"); - + else if (mode != KD_TEXT) { - + ioctl(0, KDSETMODE, KD_TEXT); - + } - + - +#elif defined(__NetBSD__) - + if (ioctl(0, WSDISPLAYIO_GMODE, &mode) == -1) - + warn("ioctl(0, WSDISPLAYIO_GMODE)"); - + else if (mode != WSDISPLAYIO_MODE_EMUL) { - + mode = WSDISPLAYIO_MODE_EMUL; - + ioctl(0, WSDISPLAYIO_SMODE, &mode); - + } - +#endif /* __NetBSD__ */ - +} - + - int main(int argc, const char *argv[]) - { - char *p; - @@ -43,6 +77,7 @@ - fprintf(stderr, "can not get I/O permissions.\n"); - exit(EXIT_FAILURE); - } - + atexit(reset_text_mode); - ChangeNewConsole(); - TermInit(argc - 1, argv + 1); - if (ReadConfig(CONFIG_NAME) < 0) { +--- src/main.c.orig 1997-01-24 09:36:48.000000000 +0900 ++++ src/main.c 2012-05-10 00:14:28.933551605 +0900 +@@ -29,12 +29,46 @@ + #include <stdlib.h> + #include <unistd.h> + ++#if defined(__FreeBSD__) ++#include <err.h> ++#include <osreldate.h> ++#if __FreeBSD_version >= 410000 ++# include <sys/consio.h> ++# include <sys/kbio.h> ++#else ++# include <machine/console.h> ++#endif ++#endif /* __FreeBSD__ */ ++ + #include <getcap.h> + + #include <version.h> + #include <term.h> + +-void main(int argc, const char *argv[]) ++/* handler for atexit() */ ++static void ++reset_text_mode(void) ++{ ++ int mode; ++ ++#if defined(__FreeBSD__) ++ if (ioctl(0, KDGETMODE, &mode) == -1) ++ warn("ioctl(0, KDGETMODE)"); ++ else if (mode != KD_TEXT) { ++ ioctl(0, KDSETMODE, KD_TEXT); ++ } ++ ++#elif defined(__NetBSD__) ++ if (ioctl(0, WSDISPLAYIO_GMODE, &mode) == -1) ++ warn("ioctl(0, WSDISPLAYIO_GMODE)"); ++ else if (mode != WSDISPLAYIO_MODE_EMUL) { ++ mode = WSDISPLAYIO_MODE_EMUL; ++ ioctl(0, WSDISPLAYIO_SMODE, &mode); ++ } ++#endif /* __NetBSD__ */ ++} ++ ++int main(int argc, const char *argv[]) + { + char *p; + +@@ -43,6 +77,7 @@ + fprintf(stderr, "can not get I/O permissions.\n"); + exit(EXIT_FAILURE); + } ++ atexit(reset_text_mode); + ChangeNewConsole(); + TermInit(argc - 1, argv + 1); + if (ReadConfig(CONFIG_NAME) < 0) { diff --git a/japanese/kon2-16dot/files/patch-src_mouse.c b/japanese/kon2-16dot/files/patch-src_mouse.c index 5b6607c63914..987dcf478cdd 100644 --- a/japanese/kon2-16dot/files/patch-src_mouse.c +++ b/japanese/kon2-16dot/files/patch-src_mouse.c @@ -1,73 +1,72 @@ - --- src/mouse.c 30 Sep 2008 08:09:56 -0000 1.1.1.2 - +++ src/mouse.c 23 Oct 2008 09:24:33 -0000 - @@ -122,11 +122,11 @@ - } - }; - - -static int mouseBaud; - +static int mouseBaud = B1200; - - static int ConfigMouseBaud(const char *config) - { - - int baud; - + int baud = 0; - - sscanf(config, "%d", &baud); - - @@ -149,19 +149,23 @@ - return SUCCESS; - } - - -static char *mouseDev; - +static char *mouseDev = NULL; - - static int ConfigMouseDev(const char *config) - { - - char name[MAX_COLS]; - - sscanf(config, "%s", name); - + char *name, *last, *sep = " \t\r\n"; - - - if (mouseDev) free(mouseDev); - + name = strtok_r((char *)config, sep, &last); - + if (name == NULL) { - + warn("unknown mouse type ignored; assuming no mouse\r\n"); - + return SUCCESS; - + } - + SafeFree(mouseDev); - mouseDev = strdup(name); - return SUCCESS; - } - - -static int pasteButton; - +static int pasteButton = MOUSE_RGT; - - static int Config3Buttons(const char *config) - { - @@ -172,12 +176,15 @@ - static int ConfigMouse(const char *config) - { - struct mouseconf *p; - - char name[MAX_COLS]; - + char *name, *last, *sep = " \t\r\n"; - - mouseType = MOUSE_NONE; - mInfo.has_mouse = FALSE; - - strncpy(name, config, MAX_COLS - 1); - - name[MAX_COLS - 1] = '\0'; - + name = strtok_r((char *)config, sep, &last); - + if (name == NULL) { - + warn("unknown mouse type ignored; assuming no mouse\r\n"); - + return SUCCESS; - + } - for (p = mice; p->name != NULL; p++) { - if (strcasecmp(name, p->name) == 0) { - mouseType = p->type; - @@ -254,7 +261,7 @@ - if ((mfd = open(mouseDev, O_RDWR|O_NONBLOCK)) < 0) { - warn("couldn't open mouse device; mouse disabled\n"); - Perror(mouseDev); - - free(mouseDev); - + SafeFree(mouseDev); - mouseDev = NULL; - mInfo.has_mouse = FALSE; - return -1; +--- src/mouse.c.orig 1997-01-27 20:40:27.000000000 +0900 ++++ src/mouse.c 2012-05-10 00:14:28.944551694 +0900 +@@ -122,11 +122,11 @@ + } + }; + +-static int mouseBaud; ++static int mouseBaud = B1200; + + static int ConfigMouseBaud(const char *config) + { +- int baud; ++ int baud = 0; + + sscanf(config, "%d", &baud); + +@@ -149,19 +149,23 @@ + return SUCCESS; + } + +-static char *mouseDev; ++static char *mouseDev = NULL; + + static int ConfigMouseDev(const char *config) + { +- char name[MAX_COLS]; +- sscanf(config, "%s", name); ++ char *name, *last, *sep = " \t\r\n"; + +- if (mouseDev) free(mouseDev); ++ name = strtok_r((char *)config, sep, &last); ++ if (name == NULL) { ++ warn("unknown mouse type ignored; assuming no mouse\r\n"); ++ return SUCCESS; ++ } ++ SafeFree(mouseDev); + mouseDev = strdup(name); + return SUCCESS; + } + +-static int pasteButton; ++static int pasteButton = MOUSE_RGT; + + static int Config3Buttons(const char *config) + { +@@ -172,11 +176,15 @@ + static int ConfigMouse(const char *config) + { + struct mouseconf *p; +- char name[MAX_COLS]; ++ char *name, *last, *sep = " \t\r\n"; + + mouseType = MOUSE_NONE; + mInfo.has_mouse = FALSE; +- sscanf(config, "%s", name); ++ name = strtok_r((char *)config, sep, &last); ++ if (name == NULL) { ++ warn("unknown mouse type ignored; assuming no mouse\r\n"); ++ return SUCCESS; ++ } + for (p = mice; p->name != NULL; p++) { + if (strcasecmp(name, p->name) == 0) { + mouseType = p->type; +@@ -253,7 +261,7 @@ + if ((mfd = open(mouseDev, O_RDWR|O_NONBLOCK)) < 0) { + warn("couldn't open mouse device; mouse disabled\n"); + Perror(mouseDev); +- free(mouseDev); ++ SafeFree(mouseDev); + mouseDev = NULL; + mInfo.has_mouse = FALSE; + return -1; diff --git a/japanese/kon2-16dot/files/patch-src_term.c b/japanese/kon2-16dot/files/patch-src_term.c index a5306cd0227c..4c5716433c2a 100644 --- a/japanese/kon2-16dot/files/patch-src_term.c +++ b/japanese/kon2-16dot/files/patch-src_term.c @@ -1,185 +1,301 @@ - --- src/term.c 30 Sep 2008 08:09:56 -0000 1.1.1.2 - +++ src/term.c 23 Oct 2008 09:24:33 -0000 - @@ -76,7 +76,7 @@ - - int masterPty; /* master pseudo-tty file descriptor */ - - -#define MAX_TTYNAME 10 - +#define MAX_TTYNAME 20 - - static int childPid, sockFd, slavePty; - static struct termio oldTio; - @@ -235,13 +235,16 @@ - } - ConsoleInit(video); - while (i < argc) { - - const char *arg; - + const char *arg = argv[i]; - - - if (argv[i][0] != '-') { - - warn("bad arg `%s'; assumed `-%s'\r\n", argv[i]); - - arg = (char *) argv[i]; - - } else - - arg = (char *) argv[i] + 1; - + if (*arg != '-') - + warn("bad arg `%s'; assumed `-%s'\n", arg, arg); - + else - + ++arg; - + if (!strcasecmp(arg, "help")) { - + message("Usage: kon2 [video] [-option value] ...\n"); - + exit(EXIT_FAILURE); - + } - i++; - if (i >= argc) { - error("no value for `%s'\r\n", arg); - @@ -258,6 +261,25 @@ - static int savedArgc; /* argc of startup time */ - static const char **savedArgv; /* argv of startup time */ - - +static int ttyNumber = 0; - + - +int - +set_vt_number(void) - +{ - +#if defined(__FreeBSD__) - + ttyNumber = strtol(ttyname(0) + 9, NULL, 16); - +#elif defined(linux) - + ttyNumber = atoi(ttyname(0) + 8); - +#endif /* linux */ - + return ttyNumber; - +} - + - +int - +TermGetNumber(void) - +{ - + return ttyNumber; - +} - + - /* Do initialization before reading config file */ - void TermInit(int argc, const char *argv[]) - { - @@ -266,6 +288,7 @@ - init.display = init.utmp = init.socket = init.termio = FALSE; - /* Initialize subsystems. */ - - + set_vt_number(); - CapInit(); - ChildInit(); - MouseInit(); - @@ -355,8 +378,8 @@ - mouseFd = MouseStart(); - } - - - chown("/dev/tty0", getuid(), getgid()); - #if defined(linux) - + chown("/dev/tty0", getuid(), getgid()); - sockFd = SocketInit(ttyname(0) + 8); - #elif defined(__FreeBSD__) - sockFd = SocketInit(ttyname(0) + 9); - @@ -381,6 +404,7 @@ - - /* Signal Setting */ - signal(SIGCHLD, ExitPty); - + signal(SIGPIPE, SIG_IGN); - signal(SIGHUP, ExitTerm); - signal(SIGTERM, ExitTerm); - signal(SIGSEGV, ExitTerm); - @@ -458,18 +482,13 @@ - PerrorExit("/dev/console"); - } - #elif defined(__FreeBSD__) - -#if __FreeBSD_version >= 501100 - - cfd = open("/dev/ttyv0", O_WRONLY); - - if (cfd < 0 && (cfd = open("/dev/ttyv0", O_RDONLY)) < 0) { - - PerrorExit("/dev/ttyv0"); - - } - -#else - - cfd = open("/dev/vga", O_WRONLY); - - if (cfd < 0 && (cfd = open("/dev/vga", O_RDONLY)) < 0) { - - PerrorExit("/dev/vga"); - + cfd = open("/dev/vga", O_RDONLY); - + if (cfd == -1) { - + cfd = open("/dev/console", O_RDONLY); - + if (cfd == -1) - + PerrorExit("/dev/console"); - } - -#endif - -#endif - +#endif /* __FreeBSD__ */ - ioctl(cfd, VT_ACTIVATE, orgVtNum); - close(cfd); - } - @@ -486,28 +505,36 @@ - cfd = open("/dev/console", O_WRONLY); - if (cfd < 0 && (cfd = open("/dev/console", O_RDONLY)) < 0) - fatal("can't open /dev/console"); - -#elif defined(__FreeBSD__) - -#if __FreeBSD_version >= 501100 - - cfd = open("/dev/ttyv0", O_WRONLY); - - if (cfd < 0 && (cfd = open("/dev/ttyv0", O_RDONLY)) < 0) - - fatal("can't open /dev/ttyv0"); - -#else - - cfd = open("/dev/vga", O_WRONLY); - - if (cfd < 0 && (cfd = open("/dev/vga", O_RDONLY)) < 0) - - fatal("can't open /dev/vga"); - -#endif - -#endif - + - ioctl(cfd, KDGETMODE, &mode); - if (mode == KD_TEXT) { - close(cfd); - return; - } - -#if defined(linux) - ioctl(cfd, VT_GETSTATE, &vts); - orgVtNum = vts.v_active; - -#endif - - ioctl(cfd, VT_OPENQRY, &vtNum); - - if (vtNum < 0) - + - +#elif defined(__FreeBSD__) - + /* check for syscons mode */ - + if (ioctl(0, KDGETMODE, &mode) == -1) - + fatal("KON is require the syscons(4)"); - + else if (mode != KD_TEXT) - + fatal("unknown terminal mode."); - + else if (strcmp(ttyname(0), "/dev/console") != 0) - + return; - + - + cfd = open("/dev/vga", O_RDONLY); - + if (cfd == -1) { - + cfd = open("/dev/console", O_RDONLY); - + if (cfd == -1) - + fatal("can't open /dev/console"); - + } - + if (ioctl(cfd, VT_GETINDEX, &orgVtNum) == -1) - + fatal("ioctl(VT_GETINDEX)"); - +#endif /* __FreeBSD__ */ - + - + errno = 0; - + if (ioctl(cfd, VT_OPENQRY, &vtNum) == -1 || vtNum < 0) - fatal("can't get free VC"); - parent = getpid(); - if ((child = fork()) == -1) - @@ -515,12 +542,13 @@ - if (child) { - signal(SIGHUP, ExitPty); - pause(); - + fatal("internal error."); - } - setsid(); - #if defined(linux) - sprintf(vtty, "/dev/tty%d", vtNum); - #elif defined(__FreeBSD__) - - sprintf(vtty, "/dev/ttyv%d", vtNum); - + sprintf(vtty, "/dev/ttyv%d", vtNum - 1); - #endif - if ((vfd = open(vtty, O_RDWR)) < 0) - fatal("can't open %s", vtty); - @@ -531,5 +559,6 @@ - dup2(vfd, 0); - dup2(vfd, 1); - dup2(vfd, 2); - + close(vfd); - kill(parent, SIGHUP); - } +--- src/term.c.orig 1997-01-25 00:03:58.000000000 +0900 ++++ src/term.c 2012-05-10 00:17:11.736555617 +0900 +@@ -33,7 +33,13 @@ + #include <termio.h> + #elif defined(__FreeBSD__) + #include <termios.h> +-#include <machine/console.h> ++#include <osreldate.h> ++#if __FreeBSD_version >= 410000 ++# include <sys/consio.h> ++# include <sys/kbio.h> ++#else ++# include <machine/console.h> ++#endif + #define termio termios + #endif + #include <signal.h> +@@ -70,12 +76,15 @@ + + int masterPty; /* master pseudo-tty file descriptor */ + +-#define MAX_TTYNAME 10 ++#define MAX_TTYNAME 20 + + static int childPid, sockFd, slavePty; + static struct termio oldTio; + static char ptyName[MAX_TTYNAME + 1]; + static int orgVtNum = -1; ++#if defined(__FreeBSD__) ++static int exec_mode = 0; ++#endif + + struct initInfo { + bool display; /* display initialized */ +@@ -129,8 +138,13 @@ + if (WEXITSTATUS(stat) & 0x7f) + if (WIFSIGNALED(stat)) + fatal("child died with signal -- %s\r\n", sys_siglist[WTERMSIG(stat)]); +- else ++ else { ++#if defined(__FreeBSD__) ++ if (exec_mode) /* reflect exit code */ ++ exit(WEXITSTATUS(stat) & 0x7f); ++#endif + fatal("child exited with status %d\r\n", WEXITSTATUS(stat) & 0x7f); ++ } + else if (signum == SIGHUP) { + fprintf(stderr, "\r\nKON> switched to new VC\r\n"); + exit(EXIT_SUCCESS); +@@ -201,11 +215,15 @@ + } + if (FD_ISSET(0, &readFds)) { + i = read(0, buff, BUFSIZ); ++#if defined(__FreeBSD__) ++ if (strncmp(getenv("TERM"), "vt100", 5) == 0) ++ i = cons25tovt100(buff, i, BUFSIZ); ++#endif + if (i > 0) write(masterPty, buff, i); + 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); +@@ -215,6 +233,27 @@ + } + } + ++#if defined(__FreeBSD__) ++/* ++ * 'e', 's', 'u' 以外の文字がないかチェックする ++ */ ++static int Check_esu(char *p) ++{ ++ for (; *p; ++p) { ++ switch (*p) { ++ case 'e': ++ return(1); ++ case 's': ++ case 'u': ++ continue; ++ default: ++ return(0); ++ } ++ } ++ return(1); ++} ++#endif ++ + static void ProcessArgs(int argc, const char *argv[]) + { + int i = 0; +@@ -226,13 +265,55 @@ + } + ConsoleInit(video); + while (i < argc) { +- const char *arg; ++ const char *arg = argv[i]; ++ ++#if defined(__FreeBSD__) ++ if (argv[i][0] == '-' && Check_esu(&argv[i][1])) { ++ char *p; + +- if (argv[i][0] != '-') { +- warn("bad arg `%s'; assumed `-%s'\r\n", argv[i]); +- arg = (char *) argv[i]; +- } else +- arg = (char *) argv[i] + 1; ++ for (p = &argv[i][1]; *p; ++p) { ++ if (*p == 'e') { ++ ConfigExecProg(&argv[i+1]); ++ ConfigMessage("Off"); ++ exec_mode = 1; ++ return; ++ } ++ else if (*p == 's') /* single user mode */ ++ UnUseUtmp(1); ++ else if (*p == 'u') { /* unset TERM mode */ ++ ConfigUnsetTerm(1); ++ } ++ } ++ } ++ else { ++ if (*arg != '-') ++ warn("bad arg `%s'; assumed `-%s'\n", arg, arg); ++ else ++ ++arg; ++ if (!strcasecmp(arg, "help")) { ++ message("Usage: kon2 [video] [-option value] ...\n"); ++ exit(EXIT_FAILURE); ++ } ++ i++; ++ if (i >= argc) { ++ error("no value for `%s'\r\n", arg); ++ break; ++ } ++ if (!strcasecmp(arg, "e")) ++ ConfigExecProg(argv[i]); ++ else if (SetCapArg(arg, argv[i]) < 0) ++ warn("invalid capability `%s' ignored\r\n", arg); ++ } ++ i++; ++#else ++ if (*arg != '-') ++ warn("bad arg `%s'; assumed `-%s'\n", arg, arg); ++ else ++ ++arg; ++ if (!strcasecmp(arg, "help")) { ++ message("Usage: kon2 [video] [-option value] ...\n"); ++ exit(EXIT_FAILURE); ++ } + i++; + if (i >= argc) { + error("no value for `%s'\r\n", arg); +@@ -243,12 +324,32 @@ + else if (SetCapArg(arg, argv[i]) < 0) + warn("invalid capability `%s' ignored\r\n", arg); + i++; ++#endif + } + } + + static int savedArgc; /* argc of startup time */ + static const char **savedArgv; /* argv of startup time */ + ++static int ttyNumber = 0; ++ ++int ++set_vt_number(void) ++{ ++#if defined(__FreeBSD__) ++ ttyNumber = strtol(ttyname(0) + 9, NULL, 16); ++#elif defined(linux) ++ ttyNumber = atoi(ttyname(0) + 8); ++#endif /* linux */ ++ return ttyNumber; ++} ++ ++int ++TermGetNumber(void) ++{ ++ return ttyNumber; ++} ++ + /* Do initialization before reading config file */ + void TermInit(int argc, const char *argv[]) + { +@@ -257,6 +358,7 @@ + init.display = init.utmp = init.socket = init.termio = FALSE; + /* Initialize subsystems. */ + ++ set_vt_number(); + CapInit(); + ChildInit(); + MouseInit(); +@@ -346,8 +448,8 @@ + mouseFd = MouseStart(); + } + +- chown("/dev/tty0", getuid(), getgid()); + #if defined(linux) ++ chown("/dev/tty0", getuid(), getgid()); + sockFd = SocketInit(ttyname(0) + 8); + #elif defined(__FreeBSD__) + sockFd = SocketInit(ttyname(0) + 9); +@@ -372,6 +474,7 @@ + + /* Signal Setting */ + signal(SIGCHLD, ExitPty); ++ signal(SIGPIPE, SIG_IGN); + signal(SIGHUP, ExitTerm); + signal(SIGTERM, ExitTerm); + signal(SIGSEGV, ExitTerm); +@@ -449,11 +552,13 @@ + PerrorExit("/dev/console"); + } + #elif defined(__FreeBSD__) +- cfd = open("/dev/vga", O_WRONLY); +- if (cfd < 0 && (cfd = open("/dev/vga", O_RDONLY)) < 0) { +- PerrorExit("/dev/vga"); ++ cfd = open("/dev/vga", O_RDONLY); ++ if (cfd == -1) { ++ cfd = open("/dev/console", O_RDONLY); ++ if (cfd == -1) ++ PerrorExit("/dev/console"); + } +-#endif ++#endif /* __FreeBSD__ */ + ioctl(cfd, VT_ACTIVATE, orgVtNum); + close(cfd); + } +@@ -470,22 +575,36 @@ + cfd = open("/dev/console", O_WRONLY); + if (cfd < 0 && (cfd = open("/dev/console", O_RDONLY)) < 0) + fatal("can't open /dev/console"); +-#elif defined(__FreeBSD__) +- cfd = open("/dev/vga", O_WRONLY); +- if (cfd < 0 && (cfd = open("/dev/vga", O_RDONLY)) < 0) +- fatal("can't open /dev/vga"); +-#endif ++ + ioctl(cfd, KDGETMODE, &mode); + if (mode == KD_TEXT) { + close(cfd); + return; + } +-#if defined(linux) + ioctl(cfd, VT_GETSTATE, &vts); + orgVtNum = vts.v_active; +-#endif +- ioctl(cfd, VT_OPENQRY, &vtNum); +- if (vtNum < 0) ++ ++#elif defined(__FreeBSD__) ++ /* check for syscons mode */ ++ if (ioctl(0, KDGETMODE, &mode) == -1) ++ fatal("KON is require the syscons(4)"); ++ else if (mode != KD_TEXT) ++ fatal("unknown terminal mode."); ++ else if (strcmp(ttyname(0), "/dev/console") != 0) ++ return; ++ ++ cfd = open("/dev/vga", O_RDONLY); ++ if (cfd == -1) { ++ cfd = open("/dev/console", O_RDONLY); ++ if (cfd == -1) ++ fatal("can't open /dev/console"); ++ } ++ if (ioctl(cfd, VT_GETINDEX, &orgVtNum) == -1) ++ fatal("ioctl(VT_GETINDEX)"); ++#endif /* __FreeBSD__ */ ++ ++ errno = 0; ++ if (ioctl(cfd, VT_OPENQRY, &vtNum) == -1 || vtNum < 0) + fatal("can't get free VC"); + parent = getpid(); + if ((child = fork()) == -1) +@@ -493,12 +612,13 @@ + if (child) { + signal(SIGHUP, ExitPty); + pause(); ++ fatal("internal error."); + } + setsid(); + #if defined(linux) + sprintf(vtty, "/dev/tty%d", vtNum); + #elif defined(__FreeBSD__) +- sprintf(vtty, "/dev/ttyv%d", vtNum); ++ sprintf(vtty, "/dev/ttyv%d", vtNum - 1); + #endif + if ((vfd = open(vtty, O_RDWR)) < 0) + fatal("can't open %s", vtty); +@@ -509,5 +629,6 @@ + dup2(vfd, 0); + dup2(vfd, 1); + dup2(vfd, 2); ++ close(vfd); + kill(parent, SIGHUP); + } diff --git a/japanese/kon2-16dot/files/patch-ag b/japanese/kon2-16dot/files/patch-src_utmp.c index 66ac5d73c41c..19f21b4b0a4a 100644 --- a/japanese/kon2-16dot/files/patch-ag +++ b/japanese/kon2-16dot/files/patch-src_utmp.c @@ -1,6 +1,6 @@ ---- 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 @@ +--- src/utmp.c.orig 1997-01-24 09:37:28.000000000 +0900 ++++ src/utmp.c 2012-05-10 04:09:42.294562501 +0900 +@@ -41,20 +41,39 @@ #include <utmp.h> #include <grp.h> #include <sys/stat.h> @@ -14,6 +14,12 @@ +static gid_t ttyGid; +static int ts; +#endif ++static int unuse_utmp = 0; ++ ++void UnUseUtmp(int flg) ++{ ++ unuse_utmp = flg; ++} void SetUtmp(char *tty) { @@ -22,11 +28,13 @@ struct passwd *pw; struct group *ttygrp; char *tn; +- +#if defined(__FreeBSD__) + struct ttyent *ttyp; + int fd, i; +#endif - ++ if (unuse_utmp) ++ return; pw = getpwuid(getuid()); tn = rindex(tty, '/') + 1; memset((char *)&utmp, 0, sizeof(utmp)); @@ -34,7 +42,7 @@ strncpy(utmp.ut_id, tn + 3, sizeof(utmp.ut_id)); utmp.ut_type = DEAD_PROCESS; setutent(); -@@ -66,21 +78,43 @@ +@@ -66,21 +85,45 @@ time(&(utmp.ut_time)); pututline(&utmp); endutent(); @@ -75,12 +83,14 @@ + struct utmp utmp; + int fd; +#endif ++ if (unuse_utmp) ++ return; +#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 @@ +@@ -93,7 +136,19 @@ time(&(utp->ut_time)); pututline(utp); endutent(); diff --git a/japanese/kon2-16dot/files/patch-src_utmpx.c b/japanese/kon2-16dot/files/patch-src_utmpx.c new file mode 100644 index 000000000000..08e6237b82fb --- /dev/null +++ b/japanese/kon2-16dot/files/patch-src_utmpx.c @@ -0,0 +1,159 @@ +--- src/utmpx.c.orig 1970-01-01 09:00:00.000000000 +0900 ++++ src/utmpx.c 2012-05-10 02:12:23.827551809 +0900 +@@ -0,0 +1,156 @@ ++/* ++ * KON2 - Kanji ON Console - ++ * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp) ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``AS IS'' AND ANY ++ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ * ++ */ ++ ++/* ++ Original utmp.c was ported from Wnn by komeda@ics.osaka-u.ac.jp. ++ This code is written by manabe@papilio.tutics.tut.ac.jp, ++ and this does not contain old code (Wnn's setutmp.c). ++ ++ Thanks to komeda@ics.osaka-u.ac.jp. ++*/ ++ ++#include <stdio.h> ++#include <unistd.h> ++#include <fcntl.h> ++#include <string.h> ++#include <pwd.h> ++#include <utmpx.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 ++static int unuse_utmp = 0; ++ ++void UnUseUtmp(int flg) ++{ ++ unuse_utmp = flg; ++} ++ ++void SetUtmp(char *tty) ++{ ++ struct utmpx utmp; ++ struct utmpx *utp; ++ ++ struct passwd *pw; ++ struct group *ttygrp; ++ char *tn; ++#if defined(__FreeBSD__) ++ struct ttyent *ttyp; ++ int fd, i; ++#endif ++ if (unuse_utmp) ++ return; ++ 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(); ++ getutid(&utmp); ++ utmp.ut_type = USER_PROCESS; ++ utmp.ut_pid = getpid(); ++ strncpy(utmp.ut_line, tn, sizeof(utmp.ut_line)); ++ strncpy(utmp.ut_user, pw->pw_name, sizeof(utmp.ut_user)); ++ time(&(utmp.ut_time)); ++ pututline(&utmp); ++ endutent(); ++#else ++ setutxent(); ++ strncpy(utmp.ut_id, tn + 3, sizeof(utmp.ut_id)); ++ utmp.ut_type = DEAD_PROCESS; ++ utp = getutxent(); ++ memcpy(&utmp, utp, sizeof(utmp)); ++ utmp.ut_type = USER_PROCESS; ++ utmp.ut_pid = getpid(); ++ strncpy(utmp.ut_line, tn, sizeof(utmp.ut_line)); ++ strncpy(utmp.ut_user, pw->pw_name, sizeof(utmp.ut_user)); ++ gettimeofday(&utmp.ut_tv, NULL); ++ pututxline(&utmp); ++ endutxent(); ++#endif ++ if ((ttygrp = getgrnam("tty")) != NULL) ++ ttyGid = ttygrp->gr_gid; ++ else ++ ttyGid = -1; ++ chmod(tty, 0622); ++ chown(tty, getuid(), ttyGid); ++} ++ ++void ResetUtmp(char *tty) ++{ ++#if !defined(__FreeBSD__) ++ struct utmp utmp, *utp; ++ char *tn; ++#else ++ struct utmpx utmp; ++ struct utmpx *utp; ++ char *tn; ++ int fd; ++#endif ++ if (unuse_utmp) ++ return; ++ ++#if !defined(__FreeBSD__) ++ tn = rindex(tty, '/') + 4; ++ memset((char *)&utmp, 0, sizeof(utmp)); ++ strncpy(utmp.ut_id, tn, sizeof(utmp.ut_id)); ++ utmp.ut_type = USER_PROCESS; ++ setutent(); ++ utp = getutid(&utmp); ++ utp->ut_type = DEAD_PROCESS; ++ memset(utp->ut_user, 0, sizeof(utmp.ut_user)); ++ utp->ut_type = DEAD_PROCESS; ++ time(&(utp->ut_time)); ++ pututline(utp); ++ endutent(); ++#else ++ tn = rindex(tty, '/') + 4; ++ memset((char *)&utmp, 0, sizeof(utmp)); ++ strncpy(utmp.ut_id, tn, sizeof(utmp.ut_id)); ++ utmp.ut_type = USER_PROCESS; ++ setutxent(); ++ utp = getutxent(); ++ memcpy(&utmp, utp, sizeof(utmp)); ++ utmp.ut_type = DEAD_PROCESS; ++ memset(utmp.ut_user, 0, sizeof(utmp.ut_user)); ++ utmp.ut_type = DEAD_PROCESS; ++ gettimeofday(&utmp.ut_tv, NULL); ++ pututxline(&utmp); ++ endutxent(); ++#endif ++ chmod(tty, 0600); ++ chown(tty, 0, ttyGid); ++} diff --git a/japanese/kon2-16dot/files/patch-src_vc.c b/japanese/kon2-16dot/files/patch-src_vc.c index c071a067a028..f37c77eb4344 100644 --- a/japanese/kon2-16dot/files/patch-src_vc.c +++ b/japanese/kon2-16dot/files/patch-src_vc.c @@ -1,59 +1,184 @@ - --- src/vc.c 30 Sep 2008 08:09:56 -0000 1.1.1.2 - +++ src/vc.c 23 Oct 2008 09:24:33 -0000 - @@ -792,22 +792,21 @@ - return SUCCESS; - } - - -static char *videoName; - +static char *videoName = NULL; - - static int ConfigDisplay(const char *config) - { - struct videoconf *v; - - char name[MAX_COLS]; - - - - sscanf(config, "%s", name); - + char *name, *last, *sep = " \t\r\n"; - + - + name = strtok_r((char *)config, sep, &last); - + if (name == NULL) { - + error("invalid entry for %s\r\n", videoName); - + return FAILURE; - + } - for (v = videos; v->name != NULL; v++) { - if (strcasecmp(name, v->name) == 0) { - - config = strchr(config, '\n'); - - if (config == NULL) { - - error("invalid entry for %s\r\n", videoName); - - return FAILURE; - - } - - if (v->set(&vInfo, config) == FAILURE) - + if (v->set(&vInfo, last) == FAILURE) - return FAILURE; - message("video type `%s' selected\r\n", name); - if (vInfo.has_hard_scroll) { - @@ -873,6 +872,7 @@ - - void ConsoleInit(const char *video) - { - + SafeFree(videoName); - videoName = strdup(video); - DefineCap(videoName, ConfigDisplay, NULL); - DefineCap("BeepCounter", ConfigBeep, "5"); - @@ -900,12 +900,12 @@ - { - scrollLine = textHead = 0; - vInfo.detatch(); - - SafeFree((void **)&textBuff); - - SafeFree((void **)&attrBuff); - - SafeFree((void **)&flagBuff); - + SafeFree(textBuff); - + SafeFree(attrBuff); - + SafeFree(flagBuff); - #ifdef linux - ioperm(COUNTER_ADDR, 1, FALSE); - #endif - - - SafeFree((void **)&videoName); - + SafeFree(videoName); - } +--- src/vc.c.orig 1997-01-25 00:06:23.000000000 +0900 ++++ src/vc.c 2012-05-10 00:14:28.968550436 +0900 +@@ -40,7 +40,13 @@ + #include <termio.h> + #elif defined(__FreeBSD__) + #include <termios.h> +-#include <machine/console.h> ++#include <osreldate.h> ++#if __FreeBSD_version >= 410000 ++# include <sys/consio.h> ++# include <sys/kbio.h> ++#else ++# include <machine/console.h> ++#endif + #endif + #include <sys/ioctl.h> + #ifdef linux +@@ -94,29 +100,22 @@ + static + inline void blatch(void *head, int n) + { +- +- __asm__("\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" ); ++ char *tmp = (char *)head; ++ do { ++ *tmp &= 0x7f; ++ tmp++; ++ } while( --n ); + } + + static + inline void llatch(void *head, int n) + { +- +- __asm__("\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" ); ++ int *tmp = (int *)head; ++ n /= 4; ++ do { ++ *tmp &= 0x7f7f7f7f; ++ tmp++; ++ } while( --n ); + } + + static inline u_int TextAddress(u_int x, u_int y) +@@ -266,12 +265,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); +@@ -297,6 +307,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) +@@ -779,22 +792,21 @@ + return SUCCESS; + } + +-static char *videoName; ++static char *videoName = NULL; + + static int ConfigDisplay(const char *config) + { + struct videoconf *v; +- char name[MAX_COLS]; +- +- sscanf(config, "%s", name); ++ char *name, *last, *sep = " \t\r\n"; ++ ++ name = strtok_r((char *)config, sep, &last); ++ if (name == NULL) { ++ error("invalid entry for %s\r\n", videoName); ++ return FAILURE; ++ } + for (v = videos; v->name != NULL; v++) { + if (strcasecmp(name, v->name) == 0) { +- config = strchr(config, '\n'); +- if (config == NULL) { +- error("invalid entry for %s\r\n", videoName); +- return FAILURE; +- } +- if (v->set(&vInfo, config) == FAILURE) ++ if (v->set(&vInfo, last) == FAILURE) + return FAILURE; + message("video type `%s' selected\r\n", name); + if (vInfo.has_hard_scroll) { +@@ -816,22 +828,32 @@ + + static int ConfigBeep(const char *confstr) + { +- beepCount = atoi(confstr) * 10000; + #if defined(linux) ++ 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 || beepCount <= 0) return; + #if defined(linux) ++ if (!con.active || beepCount <= 0) 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 + } + + static int ConfigInterval(const char *confstr) +@@ -850,6 +872,7 @@ + + void ConsoleInit(const char *video) + { ++ SafeFree(videoName); + videoName = strdup(video); + DefineCap(videoName, ConfigDisplay, NULL); + DefineCap("BeepCounter", ConfigBeep, "5"); +@@ -877,12 +900,12 @@ + { + scrollLine = textHead = 0; + vInfo.detatch(); +- SafeFree((void **)&textBuff); +- SafeFree((void **)&attrBuff); +- SafeFree((void **)&flagBuff); ++ SafeFree(textBuff); ++ SafeFree(attrBuff); ++ SafeFree(flagBuff); + #ifdef linux + ioperm(COUNTER_ADDR, 1, FALSE); + #endif + +- SafeFree((void **)&videoName); ++ SafeFree(videoName); + } diff --git a/japanese/kon2-16dot/files/patch-src_vt.c b/japanese/kon2-16dot/files/patch-src_vt.c index ce45879e48a2..749d731498e9 100644 --- a/japanese/kon2-16dot/files/patch-src_vt.c +++ b/japanese/kon2-16dot/files/patch-src_vt.c @@ -1,51 +1,258 @@ - --- src/vt.c 30 Sep 2008 08:09:56 -0000 1.1.1.2 - +++ src/vt.c 23 Oct 2008 09:24:33 -0000 - @@ -107,7 +107,7 @@ - con.bcol = saveAttr->bcol; - tmp = saveAttr; - saveAttr = tmp->prev; - - free(tmp); - + SafeFree(tmp); - } - } - - @@ -606,20 +606,23 @@ - - static int ConfigCoding(const char *confstr) - { - - char reg[3][MAX_COLS]; - + char *name, *last, *sep = " \t\r\n"; - int n, i; - - - *reg[0] = *reg[1] = *reg[2] = '\0'; - - sscanf(confstr, "%s %s %s", reg[0], reg[1], reg[2]); - - for (i = 0; i < 3 && *reg[i]; i ++) { - - n = (int)CodingByRegistry(reg[i]); - + name = strtok_r((char *)confstr, sep, &last); - + for (i = 0; i < 3; i++) { - + if (name == NULL) { - + error("invalid coding system\n"); - + return FAILURE; - + } - + n = (int)CodingByRegistry(name); - if (n < 0) { - - if (!strcasecmp(reg[i], "EUC")) - + if (!strcasecmp(name, "EUC")) - lInfo.sc = CODE_EUC; - - else if (!strcasecmp(reg[i], "SJIS")) - + else if (!strcasecmp(name, "SJIS")) - lInfo.sc = CODE_SJIS; - /* - - else if (!strcasecmp(reg[i], "BIG5")) - + else if (!strcasecmp(name, "BIG5")) - lInfo.sc = CODE_BIG5; - */ - else - @@ -633,6 +636,7 @@ - fprintf(fp,"[<%s> %d %d %d %d]\n", reg[i], n, lInfo.sb, lInfo.db, lInfo.sc); - fclose(fp);} - #endif - + name = strtok_r(NULL, sep, &last); - } - return SUCCESS; - } +--- src/vt.c.orig 1997-01-25 17:55:02.000000000 +0900 ++++ src/vt.c 2012-05-10 00:17:11.772692570 +0900 +@@ -77,6 +77,7 @@ + + static int scroll; /* スクロール行数 */ + struct langInfo lInfo; ++static u_int prefix; + + static + void SaveAttr() +@@ -107,7 +108,7 @@ + con.bcol = saveAttr->bcol; + tmp = saveAttr; + saveAttr = tmp->prev; +- free(tmp); ++ SafeFree(tmp); + } + } + +@@ -185,6 +186,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; +@@ -372,6 +378,10 @@ + case 'U': + con.g[0] = CS_GRAPH; + break; ++ case '0': ++ if (prefix == '(') ++ con.g[0] = CS_GRAPH; ++ break; + default: + while (fSRegs[i].sign0) { + if (fSRegs[i].sign0 == ch) { +@@ -412,6 +422,7 @@ + static + void EscStart(u_char ch) + { ++ prefix = ch; + con.esc = NULL; + switch(ch) { + case '[': +@@ -527,7 +538,8 @@ + con.esc = EscStart; + continue; + case CHAR_SO: +- con.trans = con.g[1] | G1_SET; ++ /* con.trans = con.g[1] | G1_SET; */ ++ con.trans = con.g[1]; + continue; + case CHAR_SI: + con.trans = con.g[0]; +@@ -585,7 +597,11 @@ + } else { + /* ANK モード */ + if (con.ins) TextInsertChar(1); +- TextSput(con.trans == CS_RIGHT ? ch | 0x80: ch); ++ if (con.trans == CS_RIGHT) ++ ch |= 0x80; ++ else if (con.trans == CS_GRAPH) ++ ch = (1 + ch) & 0x1f; ++ TextSput(ch); + con.x ++; + continue; + } +@@ -601,20 +617,23 @@ + + static int ConfigCoding(const char *confstr) + { +- char reg[3][MAX_COLS]; ++ char *name, *last, *sep = " \t\r\n"; + int n, i; + +- *reg[0] = *reg[1] = *reg[2] = '\0'; +- sscanf(confstr, "%s %s %s", reg[0], reg[1], reg[2]); +- for (i = 0; i < 3 && *reg[i]; i ++) { +- n = (int)CodingByRegistry(reg[i]); ++ name = strtok_r((char *)confstr, sep, &last); ++ for (i = 0; i < 3; i++) { ++ if (name == NULL) { ++ error("invalid coding system\n"); ++ return FAILURE; ++ } ++ n = (int)CodingByRegistry(name); + if (n < 0) { +- if (!strcasecmp(reg[i], "EUC")) ++ if (!strcasecmp(name, "EUC")) + lInfo.sc = CODE_EUC; +- else if (!strcasecmp(reg[i], "SJIS")) ++ else if (!strcasecmp(name, "SJIS")) + lInfo.sc = CODE_SJIS; + /* +- else if (!strcasecmp(reg[i], "BIG5")) ++ else if (!strcasecmp(name, "BIG5")) + lInfo.sc = CODE_BIG5; + */ + else +@@ -628,6 +647,7 @@ + fprintf(fp,"[<%s> %d %d %d %d]\n", reg[i], n, lInfo.sb, lInfo.db, lInfo.sc); + fclose(fp);} + #endif ++ name = strtok_r(NULL, sep, &last); + } + return SUCCESS; + } +@@ -654,4 +674,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 |