aboutsummaryrefslogtreecommitdiff
path: root/japanese/epic4
diff options
context:
space:
mode:
authorAkinori MUSHA <knu@FreeBSD.org>2000-12-05 12:04:46 +0000
committerAkinori MUSHA <knu@FreeBSD.org>2000-12-05 12:04:46 +0000
commit61d92038e205a5c4ba92782b31eaf18c21115770 (patch)
tree867e2ce0c880569cbbc0cc74d72db368404e0725 /japanese/epic4
parent35c1beba1d8784dd12d0ae1f1a18eefb16f2f0eb (diff)
downloadports-61d92038e205a5c4ba92782b31eaf18c21115770.tar.gz
ports-61d92038e205a5c4ba92782b31eaf18c21115770.zip
Notes
Diffstat (limited to 'japanese/epic4')
-rw-r--r--japanese/epic4/Makefile19
-rw-r--r--japanese/epic4/files/patch-Makefile.in37
-rw-r--r--japanese/epic4/files/patch-config.h11
-rw-r--r--japanese/epic4/files/patch-defs.h264
-rw-r--r--japanese/epic4/files/patch-input.c356
-rw-r--r--japanese/epic4/files/patch-kanji.c136
-rw-r--r--japanese/epic4/files/patch-kanji.h12
-rw-r--r--japanese/epic4/files/patch-parse.c29
-rw-r--r--japanese/epic4/files/patch-screen.c114
-rw-r--r--japanese/epic4/files/patch-server.c32
-rw-r--r--japanese/epic4/files/patch-term.c63
-rw-r--r--japanese/epic4/files/patch-term.h23
-rw-r--r--japanese/epic4/pkg-comment1
-rw-r--r--japanese/epic4/pkg-descr15
14 files changed, 1112 insertions, 0 deletions
diff --git a/japanese/epic4/Makefile b/japanese/epic4/Makefile
new file mode 100644
index 000000000000..3d7721843d73
--- /dev/null
+++ b/japanese/epic4/Makefile
@@ -0,0 +1,19 @@
+# New ports collection makefile for: epic4-ja
+# Date created: 4 Dec 2000
+# Whom: Akinori MUSHA aka knu <knu@idaemons.org>
+#
+# $FreeBSD$
+#
+
+CATEGORIES= japanese irc
+
+MAINTAINER= knu@FreeBSD.org
+
+MASTERDIR= ${.CURDIR}/../../irc/epic4
+
+COMMENT= ${.CURDIR}/pkg-comment
+DESCR= ${.CURDIR}/pkg-descr
+EXTRA_PATCHES= ${.CURDIR}/files/patch-*
+PATCH_STRIP= -p1
+
+.include "${MASTERDIR}/Makefile"
diff --git a/japanese/epic4/files/patch-Makefile.in b/japanese/epic4/files/patch-Makefile.in
new file mode 100644
index 000000000000..c9405a86cd90
--- /dev/null
+++ b/japanese/epic4/files/patch-Makefile.in
@@ -0,0 +1,37 @@
+--- epic4-0.9.9/source/Makefile.in.orig Thu Aug 24 04:29:55 2000
++++ epic4-0.9.9/source/Makefile.in Mon Dec 4 03:45:30 2000
+@@ -17,7 +17,7 @@
+ ircsig.o keys.o lastlog.o list.o log.o mail.o names.o network.o \
+ newio.o notice.o notify.o numbers.o output.o parse.o queue.o reg.o \
+ screen.o server.o status.o term.o timer.o vars.o who.o window.o \
+- words.o @ALLOCA@
++ words.o kanji.o @ALLOCA@
+
+ INCLUDES = -I@srcdir@/../include -I../include
+
+@@ -96,7 +96,7 @@
+ ../include/history.h ../include/hook.h ../include/input.h \
+ ../include/output.h ../include/screen.h ../include/window.h \
+ ../include/lastlog.h ../include/status.h ../include/stack.h \
+- ../include/vars.h ../include/keys.h expr2.c expr.c
++ ../include/vars.h ../include/keys.h ../include/kanji.h expr2.c expr.c
+ alist.o: alist.c ../include/irc.h ../include/defs.h \
+ ../include/config.h ../include/irc_std.h ../include/debug.h \
+ ../include/alist.h ../include/ircaux.h ../include/output.h
+@@ -342,7 +342,7 @@
+ ../include/irc_std.h ../include/debug.h ../include/ircaux.h \
+ ../include/vars.h ../include/term.h ../include/screen.h \
+ ../include/window.h ../include/lastlog.h ../include/status.h \
+- ../include/output.h
++ ../include/output.h ../include/kanji.h
+ timer.o: timer.c ../include/irc.h ../include/defs.h \
+ ../include/config.h ../include/irc_std.h ../include/debug.h \
+ ../include/ircaux.h ../include/window.h ../include/lastlog.h \
+@@ -379,6 +379,7 @@
+ ../include/irc.h ../include/irc_std.h ../include/debug.h \
+ ../include/term.h ../include/screen.h ../include/window.h \
+ ../include/lastlog.h ../include/status.h ../include/ircaux.h
++kanji.o: kanji.c ../include/kanji.h
+ wterm.o: wterm.c ../include/irc.h ../include/defs.h \
+ ../include/config.h ../include/irc_std.h ../include/debug.h \
+ ../include/ircaux.h ../include/vars.h ../include/term.h \
diff --git a/japanese/epic4/files/patch-config.h b/japanese/epic4/files/patch-config.h
new file mode 100644
index 000000000000..6443e940b286
--- /dev/null
+++ b/japanese/epic4/files/patch-config.h
@@ -0,0 +1,11 @@
+--- epic4-0.9.9/include/config.h.orig Sat Sep 23 00:59:49 2000
++++ epic4-0.9.9/include/config.h Mon Dec 4 03:44:17 2000
+@@ -370,7 +370,7 @@
+ #define DEFAULT_HELP_PROMPT 1
+ #define DEFAULT_HELP_WINDOW 0
+ #define DEFAULT_HIDE_PRIVATE_CHANNELS 0
+-#define DEFAULT_HIGH_BIT_ESCAPE 2
++#define DEFAULT_HIGH_BIT_ESCAPE 0
+ #define DEFAULT_HIGHLIGHT_CHAR "BOLD"
+ #define DEFAULT_HISTORY 150
+ #define DEFAULT_HISTORY_CIRCLEQ 1
diff --git a/japanese/epic4/files/patch-defs.h b/japanese/epic4/files/patch-defs.h
new file mode 100644
index 000000000000..3ebf117631dc
--- /dev/null
+++ b/japanese/epic4/files/patch-defs.h
@@ -0,0 +1,264 @@
+--- epic4-0.9.9/include/defs.h.orig Mon Dec 4 03:44:17 2000
++++ epic4-0.9.9/include/defs.h Mon Dec 4 03:44:17 2000
+@@ -0,0 +1,261 @@
++/* include/defs.h. Generated automatically by configure. */
++/* include/defs.h.in. Generated automatically from configure.in by autoheader. */
++
++/* Define if on AIX 3.
++ System headers sometimes define this.
++ We just want to avoid a redefinition error message. */
++#ifndef _ALL_SOURCE
++/* #undef _ALL_SOURCE */
++#endif
++
++/* Define if using alloca.c. */
++/* #undef C_ALLOCA */
++
++/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
++ This function is required for alloca.c support on those systems. */
++/* #undef CRAY_STACKSEG_END */
++
++/* Define if the `getpgrp' function takes no argument. */
++#define GETPGRP_VOID 1
++
++/* Define to `int' if <sys/types.h> doesn't define. */
++/* #undef gid_t */
++
++/* Define if you have alloca, as a function or macro. */
++#define HAVE_ALLOCA 1
++
++/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
++#define HAVE_ALLOCA_H 1
++
++/* Define to `int' if <sys/types.h> doesn't define. */
++/* #undef mode_t */
++
++/* Define if your C compiler doesn't accept -c and -o together. */
++/* #undef NO_MINUS_C_MINUS_O */
++
++/* Define if your Fortran 77 compiler doesn't accept -c and -o together. */
++/* #undef F77_NO_MINUS_C_MINUS_O */
++
++/* Define to `int' if <sys/types.h> doesn't define. */
++/* #undef pid_t */
++
++/* Define if you need to in order for stat and other things to work. */
++/* #undef _POSIX_SOURCE */
++
++/* Define as the return type of signal handlers (int or void). */
++#define RETSIGTYPE void
++
++/* Define to the type of arg1 for select(). */
++/* #undef SELECT_TYPE_ARG1 */
++
++/* Define to the type of args 2, 3 and 4 for select(). */
++/* #undef SELECT_TYPE_ARG234 */
++
++/* Define to the type of arg5 for select(). */
++/* #undef SELECT_TYPE_ARG5 */
++
++/* Define to `unsigned' if <sys/types.h> doesn't define. */
++/* #undef size_t */
++
++/* If using the C implementation of alloca, define if you know the
++ direction of stack growth for your system; otherwise it will be
++ automatically deduced at run-time.
++ STACK_DIRECTION > 0 => grows toward higher addresses
++ STACK_DIRECTION < 0 => grows toward lower addresses
++ STACK_DIRECTION = 0 => direction of growth unknown
++ */
++/* #undef STACK_DIRECTION */
++
++/* Define if you have the ANSI C header files. */
++#define STDC_HEADERS 1
++
++/* Define if `sys_siglist' is declared by <signal.h>. */
++#define SYS_SIGLIST_DECLARED 1
++
++/* Define if you can safely include both <sys/time.h> and <time.h>. */
++#define TIME_WITH_SYS_TIME 1
++
++/* Define to `int' if <sys/types.h> doesn't define. */
++/* #undef uid_t */
++
++/* Define this if you have fpathconf(2) */
++#define HAVE_FPATHCONF 1
++
++/* define this if you have getpass(3) */
++#define HAVE_GETPASS 1
++
++/* define this if you have getpgid(2) */
++#define HAVE_GETPGID 1
++
++/* define this if you have gettimeofday(2) */
++#define HAVE_GETTIMEOFDAY 1
++
++/* Define this if you have killpg(2) */
++#define HAVE_KILLPG 1
++
++/* define this if you have memmove(3) */
++#define HAVE_MEMMOVE 1
++
++/* define this if you have scandir(3) */
++#define HAVE_SCANDIR 1
++
++/* define this if you have setenv(3) */
++#define HAVE_SETENV 1
++
++/* define this if you have setsid(2) */
++#define HAVE_SETSID 1
++
++/* define this if you have snprintf(3) */
++#define HAVE_SNPRINTF 1
++
++/* define this if you have strerror(3) */
++#define HAVE_STRERROR 1
++
++/* define if you have strtoul(3) */
++#define HAVE_STRTOUL 1
++
++/* define this if you have sysconf(3) */
++#define HAVE_SYSCONF 1
++
++/* define this if you have uname(2) */
++#define HAVE_UNAME 1
++
++/* define this if you have vsnprintf(3) */
++#define HAVE_VSNPRINTF 1
++
++/* Define this if you have SUN_LEN in <sys/un.h> */
++/* #undef HAVE_SUN_LEN */
++
++/* define this if you don't have struct linger */
++/* #undef NO_STRUCT_LINGER */
++
++/* define if allow sys/time.h with time.h */
++#define TIME_WITH_SYS_TIME 1
++
++/* Define this if your getpgrp is broken posix */
++#define GETPGRP_VOID 1
++
++/* define this if an unsigned long is 32 bits */
++/* #undef UNSIGNED_LONG32 */
++
++/* define this if an unsigned int is 32 bits */
++#define UNSIGNED_INT32 1
++
++/* define this if you are unsure what is is 32 bits */
++/* #undef UNKNOWN_32INT */
++
++/* Define this if you have inet_aton(). */
++#define HAVE_INET_ATON 1
++
++/* Define this if you need to include sys/select.h */
++/* #undef NEED_SYS_SELECT_H */
++
++/*
++ * SOCKS 4 && 5 support.
++ */
++/* #undef SOCKS */
++/* #undef USE_SOCKS */
++/* #undef USE_SOCKS5 */
++/* #undef connect */
++/* #undef getsockname */
++/* #undef bind */
++/* #undef accept */
++/* #undef listen */
++/* #undef select */
++/* #undef dup */
++/* #undef dup2 */
++/* #undef fclose */
++/* #undef gethostbyname */
++/* #undef read */
++/* #undef recv */
++/* #undef recvfrom */
++/* #undef rresvport */
++/* #undef send */
++/* #undef sendto */
++/* #undef shutdown */
++/* #undef write */
++/* #undef Rconnect */
++/* #undef Rgetsockname */
++/* #undef Rgetpeername */
++/* #undef Rbind */
++/* #undef Raccept */
++/* #undef Rlisten */
++/* #undef Rselect */
++
++/* Define this if you have setsid() */
++#define HAVE_SETSID 1
++
++/* Define this if you have tparm(2) */
++#define HAVE_TPARM 1
++
++/* Define this if you have getlogin(3) */
++#define HAVE_GETLOGIN 1
++
++/* Define this if you have terminfo support */
++#define HAVE_TERMINFO 1
++
++/* Define this if you have fchdir() */
++#define HAVE_FCHDIR 1
++
++/* Define this if you have realpath() */
++#define HAVE_REALPATH 1
++
++/* Define this if you have strlcpy() */
++/* #undef HAVE_STRLCPY */
++
++/* Define this if you have strlcat() */
++/* #undef HAVE_STRLCAT */
++
++/* Define this if you have stpcpy() */
++#define HAVE_STPCPY 1
++
++/* The number of bytes in a unsigned int. */
++#define SIZEOF_UNSIGNED_INT 4
++
++/* The number of bytes in a unsigned long. */
++/* #undef SIZEOF_UNSIGNED_LONG */
++
++/* Define if you have the <dirent.h> header file. */
++#define HAVE_DIRENT_H 1
++
++/* Define if you have the <fcntl.h> header file. */
++#define HAVE_FCNTL_H 1
++
++/* Define if you have the <ndir.h> header file. */
++/* #undef HAVE_NDIR_H */
++
++/* Define if you have the <netdb.h> header file. */
++#define HAVE_NETDB_H 1
++
++/* Define if you have the <regex.h> header file. */
++#define HAVE_REGEX_H 1
++
++/* Define if you have the <sys/dir.h> header file. */
++/* #undef HAVE_SYS_DIR_H */
++
++/* Define if you have the <sys/fcntl.h> header file. */
++#define HAVE_SYS_FCNTL_H 1
++
++/* Define if you have the <sys/file.h> header file. */
++#define HAVE_SYS_FILE_H 1
++
++/* Define if you have the <sys/filio.h> header file. */
++/* #undef HAVE_SYS_FILIO_H */
++
++/* Define if you have the <sys/ndir.h> header file. */
++/* #undef HAVE_SYS_NDIR_H */
++
++/* Define if you have the <sys/select.h> header file. */
++#define HAVE_SYS_SELECT_H 1
++
++/* Define if you have the <sys/syslimits.h> header file. */
++/* #undef HAVE_SYS_SYSLIMITS_H */
++
++/* Define if you have the <sys/time.h> header file. */
++#define HAVE_SYS_TIME_H 1
++
++/* Define if you have the <sys/un.h> header file. */
++#define HAVE_SYS_UN_H 1
++
++/* Define if you have the <termcap.h> header file. */
++#define HAVE_TERMCAP_H 1
diff --git a/japanese/epic4/files/patch-input.c b/japanese/epic4/files/patch-input.c
new file mode 100644
index 000000000000..7394fd786564
--- /dev/null
+++ b/japanese/epic4/files/patch-input.c
@@ -0,0 +1,356 @@
+--- epic4-0.9.9/source/input.c.orig Sat Sep 23 01:07:16 2000
++++ epic4-0.9.9/source/input.c Mon Dec 4 03:49:56 2000
+@@ -31,6 +31,7 @@
+ #include "vars.h"
+ #include "window.h"
+ #include "output.h"
++#include "kanji.h"
+ #include <sys/ioctl.h> /* XXX ugh */
+
+ /*
+@@ -70,7 +71,6 @@
+ #define INPUT_LINE current_screen->input_line
+ #define CUT_BUFFER cut_buffer
+ #define SET_CUT_BUFFER(x) malloc_strcpy(&CUT_BUFFER, x);
+-
+ #define BUILT_IN_KEYBINDING(x) void x (char key, char *string)
+
+
+@@ -81,9 +81,19 @@
+
+ while (*str && i < len)
+ {
+- term_putchar(*str);
+- str++, i++;
++ if (ISKANJI(*str) && ISKANJI(*(str+1))) {
++ if (i < len - 1) {
++ term_putchar(*str, *(str+1));
++ str += 2; i += 2;
++ } else {
++ break; /* goto END */
++ }
++ } else {
++ term_putchar(*str, '\0');
++ str++, i++;
++ }
+ }
++ /* END: */
+ return i;
+ }
+
+@@ -321,9 +331,16 @@
+ */
+ if (START_ZONE == WIDTH)
+ INPUT_ONSCREEN = 0;
+- else
++ else {
++ int pos = THIS_POS;
+ INPUT_ONSCREEN = START_ZONE - WIDTH - INPUT_PROMPT_LEN;
+-
++ /* adjust kanji */
++ while (pos > INPUT_ONSCREEN) {
++ ISKANJI(INPUT_BUFFER[pos - 1]) ? pos -= 2 : pos--;
++ }
++ INPUT_ONSCREEN = pos;
++ }
++
+ /*
+ * And the cursor is simply how many characters away THIS_POS is
+ * from the first column on the screen.
+@@ -468,16 +485,28 @@
+ {
+ if (THIS_CHAR)
+ {
+- THIS_POS++;
+- term_cursor_right();
++ if (ISKANJI (THIS_CHAR)) {
++ THIS_POS+=2;
++ term_right(2);
++ }else{
++ THIS_POS++;
++ term_cursor_right();
++ }
+ }
+ }
+ else
+ {
+ if (THIS_POS > MIN_POS)
+ {
+- THIS_POS--;
+- term_cursor_left();
++ if (THIS_POS > MIN_POS - 1
++ && ISKANJI(PREV_CHAR)
++ && ISKANJI(INPUT_BUFFER[THIS_POS-2])) {
++ THIS_POS -= 2;
++ term_left(2);
++ }else{
++ THIS_POS--;
++ term_cursor_left();
++ }
+ }
+ }
+ update_input(NO_UPDATE);
+@@ -590,7 +619,7 @@
+ update_input(UPDATE_JUST_CURSOR);
+ }
+
+-static void input_delete_char_from_screen (void)
++static void input_delete_char_from_screen (int count)
+ {
+ /*
+ * Remove the current character from the screen's display.
+@@ -607,7 +636,7 @@
+ /*
+ * Delete the character. This is the simple part.
+ */
+- term_delete(1);
++ term_delete(count);
+
+ /*
+ * So right now we have a blank space at the right of the
+@@ -615,14 +644,14 @@
+ * is out in that position, we need to find it and display it.
+ */
+ if (INPUT_ONSCREEN == 0) /* UGH! */
+- pos = last_input_screen->co - INPUT_PROMPT_LEN - 1;
++ pos = last_input_screen->co - INPUT_PROMPT_LEN - count;
+ else
+- pos = INPUT_ONSCREEN + last_input_screen->co - 1;
++ pos = INPUT_ONSCREEN + last_input_screen->co - count;
+
+ if (pos < strlen(INPUT_BUFFER))
+ {
+- term_move_cursor(last_input_screen->co - 1, INPUT_LINE);
+- term_putchar(INPUT_BUFFER[pos]);
++ term_move_cursor(last_input_screen->co - count, INPUT_LINE);
++ term_putchar(INPUT_BUFFER[pos], '\0');
+ term_move_cursor(INPUT_CURSOR, INPUT_LINE);
+ }
+
+@@ -637,6 +666,7 @@
+ */
+ BUILT_IN_KEYBINDING(input_delete_character)
+ {
++ int count;
+ cursor_to_input();
+
+ /*
+@@ -646,12 +676,14 @@
+ if (!THIS_CHAR)
+ return;
+
++ count = ISKANJI(THIS_CHAR) ? 2 : 1;
++
+ /*
+ * Remove the current character from the logical buffer
+ * and also from the screen.
+ */
+- ov_strcpy(&THIS_CHAR, &NEXT_CHAR);
+- input_delete_char_from_screen();
++ ov_strcpy(&THIS_CHAR, &INPUT_BUFFER[THIS_POS+count]);
++ input_delete_char_from_screen(count);
+ }
+
+
+@@ -804,7 +836,24 @@
+ */
+ BUILT_IN_KEYBINDING(input_add_character)
+ {
++ static u_char c1 = '\0', c2;
+ int display_flag = NO_UPDATE;
++ int length;
++
++ /* add by atsushi */
++ if (ISKANJI(key)) {
++ if (c1 == '\0') { /* kanji 1st char */
++ c1 = key;
++ return;
++ }else{ /* kanji 2nd char */
++ c2 = key;
++ length = 2;
++ }
++ }else{
++ c1 = key;
++ length = 1;
++ }
++ /* end add */
+
+ cursor_to_input();
+
+@@ -812,7 +861,7 @@
+ term_echo(last_input_screen->promptlist->echo);
+
+ /* Don't permit the input buffer to get too big. */
+- if (THIS_POS >= INPUT_BUFFER_SIZE)
++ if (THIS_POS + length > INPUT_BUFFER_SIZE) /* change */
+ {
+ term_echo(1);
+ return;
+@@ -832,7 +881,12 @@
+ * Add to logical buffer
+ */
+ ptr = LOCAL_COPY(&(THIS_CHAR));
+- THIS_CHAR = key;
++ /* add */
++ THIS_CHAR = c1;
++ if (length > 1) {
++ THIS_POS++;
++ THIS_CHAR = c2;
++ } /* end add */
+ NEXT_CHAR = 0;
+ ADD_TO_INPUT(ptr);
+
+@@ -843,7 +897,7 @@
+ term_insert(key);
+ else
+ {
+- term_putchar(key);
++ term_putchar(c1, c2);
+ if (NEXT_CHAR)
+ display_flag = UPDATE_FROM_CURSOR;
+ else
+@@ -855,26 +909,41 @@
+ /*
+ * Add to logical buffer
+ */
+- THIS_CHAR = key;
++ /* add */
++ THIS_CHAR = c1;
++ if (length > 1) {
++ THIS_POS++;
++ THIS_CHAR = c2;
++ } /* end add */
+ NEXT_CHAR = 0;
+
+ /* Add to display screen */
+- term_putchar(key);
++ term_putchar(c1, c2);
+ }
+ }
+
+ /* Overstrike mode. Much simpler. */
++ /* Maybe we must change here (atsushi) */
+ else
+ {
+- if (THIS_CHAR == 0)
++ if (THIS_CHAR == 0)
+ NEXT_CHAR = 0;
+- THIS_CHAR = key;
+- term_putchar(key);
++ THIS_CHAR = c1;
++ /* add */
++ if (length > 1) {
++ THIS_POS++;
++ if (THIS_CHAR == 0)
++ NEXT_CHAR = 0;
++ THIS_CHAR = c2;
++ } /* end add */
++
++ term_putchar(c1, c2);
+ }
+
+ THIS_POS++;
+ update_input(display_flag);
+ term_echo(1);
++ c1 = '\0';
+ }
+
+ /* input_clear_to_eol: erases from the cursor to the end of the input buffer */
+@@ -935,8 +1004,8 @@
+ cursor_to_input();
+ if (last_input_screen->buffer_pos > MIN_POS)
+ {
+- u_char c1, c2;
+- int pos, end_of_line = 0;
++ u_char c1[2], c2[2];
++ int pos, ptr, end_of_line = 0;
+
+ /*
+ * If we're in the middle of the input buffer,
+@@ -956,6 +1025,9 @@
+ {
+ pos = THIS_POS - 1;
+ end_of_line = 1;
++ if (ISKANJI(INPUT_BUFFER[pos])) {
++ pos--;
++ }
+ }
+
+ /*
+@@ -968,25 +1040,49 @@
+ /*
+ * Swap the two characters
+ */
+- c1 = INPUT_BUFFER[pos];
+- c2 = INPUT_BUFFER[pos] = INPUT_BUFFER[pos - 1];
+- INPUT_BUFFER[pos - 1] = c1;
++ if (pos > 1 &&
++ ISKANJI(INPUT_BUFFER[pos - 1]) &&
++ ISKANJI(INPUT_BUFFER[pos - 2])) {
++ c2[0] = INPUT_BUFFER[pos - 2];
++ c2[1] = INPUT_BUFFER[pos - 1];
++ ptr = pos - 2;
++ } else {
++ c2[0] = INPUT_BUFFER[pos - 1];
++ c2[1] = '\0';
++ ptr = pos - 1;
++ }
+
++ if (ISKANJI(INPUT_BUFFER[pos])) {
++ c1[0] = INPUT_BUFFER[ptr++] = INPUT_BUFFER[pos];
++ c1[1] = INPUT_BUFFER[ptr++] = INPUT_BUFFER[pos + 1];
++ } else {
++ c1[0] = INPUT_BUFFER[ptr++] = INPUT_BUFFER[pos];
++ c1[1] = '\0';
++ }
++ /* adjust THIS_POS */
++ if (!end_of_line)
++ THIS_POS = ptr;
++
++ INPUT_BUFFER[ptr++] = c2[0];
++ if (c2[1]) {
++ INPUT_BUFFER[ptr] = c2[1];
++ }
++
+ /*
+ * Adjust the cursor and output the new chars.
+ */
+- term_cursor_left();
+ if (end_of_line)
+- term_cursor_left();
+- term_putchar(c1);
+- term_putchar(c2);
++ c1[1] ? term_left(2) : term_cursor_left();
++ c2[1] ? term_left(2) : term_cursor_left();
++ term_putchar(c1[0], c1[1]);
++ term_putchar(c2[0], c2[1]);
+
+ /*
+ * Move the cursor back onto 'c2', if we're not at
+ * the end of the input line.
+ */
+ if (!end_of_line)
+- term_cursor_left();
++ c2[1] ? term_left(2) : term_cursor_left();
+
+ /*
+ * Reset the internal cursor.
+@@ -1232,7 +1328,6 @@
+
+ if (xxx_return)
+ return;
+-
+ /* If the high bit is set, mangle it as neccesary. */
+ if (key & 0x80)
+ {
+@@ -1242,9 +1337,8 @@
+ key &= ~0x80;
+ }
+ else if (!term_eight_bit())
+- key &= ~0x80;
++ key &= ~0x80;
+ }
+-
+ extended_key = key;
+
+ /* If we just hit the quote character, add this character literally */
diff --git a/japanese/epic4/files/patch-kanji.c b/japanese/epic4/files/patch-kanji.c
new file mode 100644
index 000000000000..b06146436ef6
--- /dev/null
+++ b/japanese/epic4/files/patch-kanji.c
@@ -0,0 +1,136 @@
+--- epic4-0.9.9/source/kanji.c.orig Mon Dec 4 03:44:17 2000
++++ epic4-0.9.9/source/kanji.c Mon Dec 4 03:44:17 2000
+@@ -0,0 +1,133 @@
++/* kanji.c */
++#include "kanji.h"
++
++#ifndef TRUE
++#define TRUE 1
++#endif
++
++#ifndef FALSE
++#define FALSE 0
++#endif
++
++#define ESC '\033'
++#define KI1 '$'
++#define KI21 'B'
++#define KI22 '@'
++#define KO1 '('
++#define KO21 'B'
++#define KO22 'J'
++#define KO23 'H'
++
++#define EUC2JIS(c) (unsigned char)((c) & 0x7f)
++#define JIS2EUC(c) (char)((c) | 0x80)
++
++/* proto types */
++static int ParseESC(char **jisstr);
++
++/* Euc2Jis : convert euc to jis. */
++/* eucstr : input string (euc) */
++/* jisstr : output string (jis) */
++/* limit : output string limit length */
++int Euc2Jis(unsigned char *eucstr, char *jisstr, int limit)
++{
++ int length, shifted;
++
++ shifted = FALSE;
++
++ while (*eucstr) {
++ length = 0;
++ if(ISKANJI(*eucstr)){
++ if(!shifted){
++ *jisstr++ = ESC;
++ *jisstr++ = KI1;
++ *jisstr++ = KI21;
++ shifted = TRUE;
++ length += 3;
++ }
++ *jisstr++ = EUC2JIS(*eucstr++);
++ *jisstr++ = EUC2JIS(*eucstr++);
++ length += 2;
++ }else{
++ if(shifted){
++ *jisstr++ = ESC;
++ *jisstr++ = KO1;
++ *jisstr++ = KO21;
++ length += 3;
++ shifted = FALSE;
++ }
++ *jisstr++ = *eucstr++;
++ length += 1;
++ }
++
++ limit -= length;
++ if(limit < 4){
++ jisstr -= length;
++ break; /* goto _break_1; */
++ }
++ }
++ _break_1:
++ if (shifted) {
++ *jisstr++ = ESC;
++ *jisstr++ = KO1;
++ *jisstr++ = KO21;
++ }
++ *jisstr = '\0';
++ return 0;
++}
++
++
++/* Jis2Euc : convert jis to euc. */
++/* jisstr : input string (jis) */
++/* eucstr : output string (euc) */
++void Jis2Euc(char *jisstr, unsigned char *eucstr)
++{
++ int shifted;
++ char c;
++ char* bg = eucstr;
++
++ shifted = FALSE;
++
++ while ((c = *jisstr++) != '\0') {
++ if (c == ESC) {
++ shifted = ParseESC(&jisstr);
++ }else{
++ if (shifted) {
++ if (*jisstr) {
++ *eucstr++ = JIS2EUC(c);
++ *eucstr++ = JIS2EUC(*jisstr);
++ jisstr++;
++ }
++ }else{
++ *eucstr++ = c;
++ }
++ }
++ }
++ *eucstr = '\0';
++}
++
++
++/* ParseESC : parse escape code */
++/* input : esc code */
++/* output : ESC $ B / ESC $ @ / ESC $ @ : shifted and skip esc code */
++/* ESC ( B / ESC ( J / ESC ( H : unshifted and skip esc code */
++int ParseESC(char **jisstr)
++{
++ char c1, c2;
++ int shifted;
++ char* pos = *jisstr;
++
++ shifted = FALSE;
++ c1 = *pos++; c2 = c1 ? *pos++ : '\0';
++
++ if (c1 == KO1) {
++ if (c2 == KO21 || c2 == KO22 || c2 == KO23) {
++ *jisstr = pos;
++ }
++ } else if (c1 == KI1) {
++ if (c2 == KI21 || c2 == KI22) {
++ *jisstr = pos;
++ shifted = TRUE;
++ }
++ }
++ return shifted;
++}
diff --git a/japanese/epic4/files/patch-kanji.h b/japanese/epic4/files/patch-kanji.h
new file mode 100644
index 000000000000..4019b9afd61f
--- /dev/null
+++ b/japanese/epic4/files/patch-kanji.h
@@ -0,0 +1,12 @@
+--- epic4-0.9.9/include/kanji.h.orig Mon Dec 4 03:44:17 2000
++++ epic4-0.9.9/include/kanji.h Mon Dec 4 03:44:17 2000
+@@ -0,0 +1,9 @@
++/* kanji.h */
++#ifndef __kanji_h__
++#define __kanji_h__
++
++#define ISKANJI(c) (0x80 & (unsigned char)(c))
++extern int Euc2Jis(unsigned char *eucstr, char *jisstr, int limit);
++extern void Jis2Euc(char *jisstr, unsigned char *eucstr);
++
++#endif
diff --git a/japanese/epic4/files/patch-parse.c b/japanese/epic4/files/patch-parse.c
new file mode 100644
index 000000000000..b5ca0ccb3c4e
--- /dev/null
+++ b/japanese/epic4/files/patch-parse.c
@@ -0,0 +1,29 @@
+--- epic4-0.9.9/source/parse.c.orig Wed Aug 16 02:25:44 2000
++++ epic4-0.9.9/source/parse.c Mon Dec 4 03:44:17 2000
+@@ -30,6 +30,7 @@
+ #include "notify.h"
+ #include "notice.h"
+ #include "timer.h"
++#include "kanji.h"
+
+ #define STRING_CHANNEL '+'
+ #define MULTI_CHANNEL '#'
+@@ -1131,7 +1132,7 @@
+ * parse_server: parses messages from the server, doing what should be done
+ * with them
+ */
+-void parse_server (char *orig_line)
++void parse_server (char *raw_line)
+ {
+ char *from,
+ *comm;
+@@ -1143,6 +1144,9 @@
+ int cnt;
+ char *line = NULL;
+ size_t size;
++ char orig_line[BIG_BUFFER_SIZE];
++
++ Jis2Euc(raw_line, orig_line);
+
+ if (num_protocol_cmds == -1)
+ num_protocol_cmds = NUMBER_OF_COMMANDS;
diff --git a/japanese/epic4/files/patch-screen.c b/japanese/epic4/files/patch-screen.c
new file mode 100644
index 000000000000..b5a0bef06b7b
--- /dev/null
+++ b/japanese/epic4/files/patch-screen.c
@@ -0,0 +1,114 @@
+--- epic4-0.9.9/source/screen.c.orig Thu Aug 10 09:28:50 2000
++++ epic4-0.9.9/source/screen.c Mon Dec 4 03:44:17 2000
+@@ -11,6 +11,7 @@
+ */
+
+ #define __need_putchar_x__
++#define __need_putchars_x__
+ #define __need_term_flush__
+ #include "irc.h"
+ #include "alias.h"
+@@ -33,6 +34,7 @@
+ #include "commands.h"
+ #include "parse.h"
+ #include "newio.h"
++#include "kanji.h"
+
+ /*
+ * When some code wants to override the default lastlog level, and needs
+@@ -496,6 +498,7 @@
+ *words,
+ *str,
+ *pos_copy;
++ u_char c1 = '\0';
+
+ if (recursion)
+ panic("prepare_display() called recursively");
+@@ -673,7 +676,8 @@
+
+ default:
+ {
+- if (*ptr == ' ' || strchr(words, *ptr))
++ if (*ptr == ' ' || strchr(words, *ptr)
++ || (ISKANJI(*ptr) && c1 != '\0'))
+ {
+ if (indent == 0)
+ {
+@@ -681,16 +685,30 @@
+ firstwb = pos;
+ }
+ word_break = pos;
+- if (*ptr != ' ' && ptr[1] &&
++ if((ISKANJI(*ptr) && c1 != '\0')) {
++ if (col < max_cols) {
++ word_break += 2;
++ buffer[pos++] = c1;
++ }else{
++ word_break--;
++ }
++ c1 = '\0';
++ } else if (*ptr != ' ' && ptr[1] &&
+ (col + 1 < max_cols))
+ word_break++;
++
+ buffer[pos++] = *ptr;
+ }
+ else
+ {
+ if (indent == -1)
+- indent = col;
+- buffer[pos++] = *ptr;
++ indent = col;
++ if (ISKANJI(*ptr)) {
++ c1 = *ptr;
++ } else {
++ buffer[pos++] = *ptr;
++ }
++
+ }
+ col++;
+ break;
+@@ -1494,9 +1512,19 @@
+ * a LOT faster, as we have already done the processing once
+ * to make output "terminal friendly".
+ */
+- if (output)
+- putchar_x(*ptr);
+- out++;
++ if (ISKANJI(*ptr) && *(ptr + 1)) {
++ if (output) {
++ unsigned char k[3];
++ k[0] = *ptr++; k[1] = *ptr; k[2] = '\0';
++ putchars_x(k);
++ }
++ out += 2;
++ } else {
++ if (output) {
++ putchar_x(*ptr);
++ }
++ out++;
++ }
+ }
+ }
+ ptr++;
+@@ -2562,6 +2590,10 @@
+ case 1:
+ case 6:
+ {
++ if(ISKANJI(chr) && ISKANJI(this_char())) {
++ output[pos++] = chr;
++ output[pos++] = next_char();
++ } else {
+ int my_gcmode = gcmode;
+
+ /*
+@@ -2654,7 +2686,8 @@
+ case 0:
+ break;
+ }
+- break;
++ }
++ break;
+ }
+
+
diff --git a/japanese/epic4/files/patch-server.c b/japanese/epic4/files/patch-server.c
new file mode 100644
index 000000000000..f6a34f449aa1
--- /dev/null
+++ b/japanese/epic4/files/patch-server.c
@@ -0,0 +1,32 @@
+--- epic4-0.9.9/source/server.c.orig Fri Sep 29 03:16:55 2000
++++ epic4-0.9.9/source/server.c Mon Dec 4 03:44:17 2000
+@@ -826,6 +826,7 @@
+ char buffer[BIG_BUFFER_SIZE * 3 + 1]; /* make this buffer *much*
+ * bigger than needed */
+ size_t size = BIG_BUFFER_SIZE * 3;
++ char jis_buffer[BIG_BUFFER_SIZE + 1];
+ int len,
+ des;
+ int server;
+@@ -845,16 +846,18 @@
+ yell("mangle_line truncated results! Ick.");
+ }
+
++ Euc2Jis(buffer, jis_buffer, IRCD_BUFFER_SIZE -2);
++ len = strlen(jis_buffer);
+ server_list[server].sent = 1;
+ if (len > (IRCD_BUFFER_SIZE - 2) || len == -1)
+ buffer[IRCD_BUFFER_SIZE - 2] = 0;
+ if (x_debug & DEBUG_OUTBOUND)
+ yell("[%d] -> [%s]", des, buffer);
+- strmcat(buffer, "\r\n", IRCD_BUFFER_SIZE);
++ strmcat(jis_buffer, "\r\n", IRCD_BUFFER_SIZE);
+ if (do_hook(SEND_TO_SERVER_LIST, "%d %d %s",
+- server, des, buffer))
++ server, des, jis_buffer))
+ {
+- if (write(des, buffer, strlen(buffer)) == -1 &&
++ if (write(des, jis_buffer, strlen(jis_buffer)) == -1 &&
+ (!get_int_var(NO_FAIL_DISCONNECT_VAR)))
+ {
+ server_list[server].save_channels = 1;
diff --git a/japanese/epic4/files/patch-term.c b/japanese/epic4/files/patch-term.c
new file mode 100644
index 000000000000..1ccef286995b
--- /dev/null
+++ b/japanese/epic4/files/patch-term.c
@@ -0,0 +1,63 @@
+--- epic4-0.9.9/source/term.c.orig Tue Aug 22 02:48:46 2000
++++ epic4-0.9.9/source/term.c Mon Dec 4 03:44:17 2000
+@@ -9,6 +9,7 @@
+ */
+
+ #define __need_putchar_x__
++#define __need_putchars_x__
+ #define __need_term_flush__
+ #include "irc.h"
+ #include "ircaux.h"
+@@ -17,6 +18,7 @@
+ #include "window.h"
+ #include "screen.h"
+ #include "output.h"
++#include "kanji.h"
+
+ /*
+ * If "HAVE_TERMINFO" is #define'd then we will use terminfo type function
+@@ -618,8 +620,10 @@
+ * we need to worry about here is making sure nothing suspcious, like an
+ * escape, makes its way to the output stream.
+ */
+-void term_putchar (unsigned char c)
++void term_putchar (unsigned char c1, unsigned char c2)
+ {
++ unsigned char c = c1;
++
+ if (!term_echo_flag)
+ {
+ putchar_x(' ');
+@@ -656,12 +660,20 @@
+ putchar_x('?');
+ term_standout_off();
+ }
+-
++
++ /* add */
++ else if (ISKANJI(c1) && ISKANJI(c2)) {
++ unsigned char k[3];
++ /* unsigned char tmp[10]; */
++
++ k[0] = c1; k[1] = c2; k[2] = '\0';
++ putchars_x(k);
++ }
+ /*
+ * Everything else is passed through.
+ */
+- else
+- putchar_x(c);
++ else
++ putchar_x(c);
+ }
+
+
+@@ -1303,7 +1315,7 @@
+ else if (current_term->TI_ich)
+ tputs_x (tparm(current_term->TI_ich, 1));
+
+- term_putchar (c);
++ term_putchar (c, '\0');
+
+ if (current_term->TI_rmir)
+ tputs_x(current_term->TI_rmir);
diff --git a/japanese/epic4/files/patch-term.h b/japanese/epic4/files/patch-term.h
new file mode 100644
index 000000000000..4ab3d307480a
--- /dev/null
+++ b/japanese/epic4/files/patch-term.h
@@ -0,0 +1,23 @@
+--- epic4-0.9.9/include/term.h.orig Thu Feb 10 05:07:39 2000
++++ epic4-0.9.9/include/term.h Mon Dec 4 03:44:17 2000
+@@ -30,6 +30,11 @@
+ static int putchar_x (int c) { return fputc((int) c, current_ftarget ); }
+ #endif
+
++#ifdef __need_putchars_x__
++__inline__
++static int putchars_x (char* c) { return fputs( c, current_ftarget ); }
++#endif
++
+ #ifdef __need_term_flush__
+ __inline__
+ static void term_flush (void) { fflush( current_ftarget ); }
+@@ -632,7 +637,7 @@
+ int term_init (void);
+ int term_resize (void);
+ void term_pause (char, char *);
+- void term_putchar (unsigned char);
++ void term_putchar (unsigned char, unsigned char);
+ void term_scroll (int, int, int);
+ void term_insert (unsigned char);
+ void term_delete (int);
diff --git a/japanese/epic4/pkg-comment b/japanese/epic4/pkg-comment
new file mode 100644
index 000000000000..2f3c92e7ab11
--- /dev/null
+++ b/japanese/epic4/pkg-comment
@@ -0,0 +1 @@
+The (E)nhanced (P)rogrammable (I)RC-II (C)lient with Japanese support
diff --git a/japanese/epic4/pkg-descr b/japanese/epic4/pkg-descr
new file mode 100644
index 000000000000..b723f8140dfd
--- /dev/null
+++ b/japanese/epic4/pkg-descr
@@ -0,0 +1,15 @@
+EPIC4 is a new direction in ircII development. No longer is EPIC 100%
+backwards compatable with ircII, but instead those things where
+compatability is undesirable have been found and fixed. No gratuitous
+incompatabilities have been added, but lots of new code has been added to
+make EPIC the best ircII client available.
+
+EPIC no longer shares any file names with ircII, so they should happily
+co-exist.
+
+WWW: http://www.epicsol.org/
+
+Japanese support patch was originally done by Atsushi Tagami
+<tagami@pp.iij4u.or.jp> and made available at the following website.
+
+http://www2.freeweb.ne.jp/~atsu/epic/index.html