summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMamoru Komachi <usata@gentoo.org>2004-06-06 16:52:12 +0000
committerMamoru Komachi <usata@gentoo.org>2004-06-06 16:52:12 +0000
commit38ddedafc97bc576ae4d7a6a3b00b178939fab98 (patch)
tree390abcc5ba122fc65ebe4f74a5a47641fa1f9b22 /sys-libs/slang
parentstable on amd64 (Manifest recommit) (diff)
downloadgentoo-2-38ddedafc97bc576ae4d7a6a3b00b178939fab98.tar.gz
gentoo-2-38ddedafc97bc576ae4d7a6a3b00b178939fab98.tar.bz2
gentoo-2-38ddedafc97bc576ae4d7a6a3b00b178939fab98.zip
Added unicode patches. Thanks to Alexander Darovsky <adarovsky@users.sf.net> and Stanislav Karchebny <berk@inbox.ru>, see bug #47675 and #52846.
Diffstat (limited to 'sys-libs/slang')
-rw-r--r--sys-libs/slang/ChangeLog9
-rw-r--r--sys-libs/slang/Manifest5
-rw-r--r--sys-libs/slang/files/digest-slang-1.4.9-r17
-rw-r--r--sys-libs/slang/files/slang-1.4.9-autoconf.dif149
-rw-r--r--sys-libs/slang/files/slang-1.4.9-fsuid.dif31
-rw-r--r--sys-libs/slang/files/slang-1.4.9.dif72
-rw-r--r--sys-libs/slang/files/slang-debian-utf8.patch917
-rw-r--r--sys-libs/slang/files/slang-utf8-acs.patch417
-rw-r--r--sys-libs/slang/files/slang-utf8-fix.patch34
-rw-r--r--sys-libs/slang/metadata.xml10
-rw-r--r--sys-libs/slang/slang-1.4.5-r1.ebuild4
-rw-r--r--sys-libs/slang/slang-1.4.5-r2.ebuild4
-rw-r--r--sys-libs/slang/slang-1.4.9-r1.ebuild63
13 files changed, 1714 insertions, 8 deletions
diff --git a/sys-libs/slang/ChangeLog b/sys-libs/slang/ChangeLog
index 12209f2ff497..780a55c774db 100644
--- a/sys-libs/slang/ChangeLog
+++ b/sys-libs/slang/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for sys-libs/slang
# Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-libs/slang/ChangeLog,v 1.24 2004/04/27 23:27:18 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/slang/ChangeLog,v 1.25 2004/06/06 16:52:12 usata Exp $
+
+*slang-1.4.9-r1 (07 Jun 2004)
+
+ 07 Jun 2004; Mamoru KOMACHI <usata@gentoo.org> metadata.xml,
+ +slang-1.4.9-r1.ebuild:
+ Added unicode patches. Thanks to Alexander Darovsky <adarovsky@users.sf.net>
+ and Stanislav Karchebny <berk@inbox.ru>, see bug #47675 and #52846.
27 Apr 2004; Mike Frysinger <vapier@gentoo.org> slang-1.4.9.ebuild :
Mark arm stable and remove the trimming of the gcc/slang.h stuff since
diff --git a/sys-libs/slang/Manifest b/sys-libs/slang/Manifest
index 93643027c07b..dfb573dbcc9e 100644
--- a/sys-libs/slang/Manifest
+++ b/sys-libs/slang/Manifest
@@ -3,6 +3,11 @@ MD5 b400a6ad56bd98b0967c84006e874d99 slang-1.4.5-r2.ebuild 1197
MD5 b51e6e53b69afbd8fa4d0c38002c7f47 slang-1.4.9.ebuild 1174
MD5 e72a704155040b1950b53c4b8e3f09ec ChangeLog 3403
MD5 d69f09410d6e4778cc20b240ca975161 metadata.xml 277
+MD5 ab2ba8fce884318fbb0f2d18cd8f0b7e slang-1.4.9-r1.ebuild 2209
MD5 b33b25719286e6314758026cdaf75fb2 files/digest-slang-1.4.5-r1 63
MD5 b33b25719286e6314758026cdaf75fb2 files/digest-slang-1.4.5-r2 63
MD5 074ddbf39cb8b9708ca9de2b1fb24366 files/digest-slang-1.4.9 64
+MD5 4779957b34cfe08dba3beefa37ad965b files/slang-debian-utf8.patch 20871
+MD5 3531d8ba2b07b43cf6d758815200bfa9 files/slang-utf8-acs.patch 14366
+MD5 4be647282e8c01060db9d1707098bd1d files/slang-utf8-fix.patch 855
+MD5 64c5a64ef6f64bed27d31d906c8c7f5a files/digest-slang-1.4.9-r1 445
diff --git a/sys-libs/slang/files/digest-slang-1.4.9-r1 b/sys-libs/slang/files/digest-slang-1.4.9-r1
new file mode 100644
index 000000000000..06193fb25edc
--- /dev/null
+++ b/sys-libs/slang/files/digest-slang-1.4.9-r1
@@ -0,0 +1,7 @@
+MD5 4fbb1a7f1257e065ca830deefe13d350 slang-1.4.9.tar.bz2 631079
+MD5 5617c722a455c1aa405c699ff361bd58 slang-1.4.9.dif 1808
+MD5 007cb225c11034b59197bdb5d507aa84 slang-1.4.9-fsuid.dif 808
+MD5 11daf6d137e1d6ec0e3475e55522cd06 slang-1.4.9-autoconf.dif 4143
+MD5 e2ddc20bfbb1ac10becb53e1707b067c slang-debian-utf8.patch 21377
+MD5 3531d8ba2b07b43cf6d758815200bfa9 slang-utf8-acs.patch 14366
+MD5 4be647282e8c01060db9d1707098bd1d slang-utf8-fix.patch 855
diff --git a/sys-libs/slang/files/slang-1.4.9-autoconf.dif b/sys-libs/slang/files/slang-1.4.9-autoconf.dif
new file mode 100644
index 000000000000..db3d2a934833
--- /dev/null
+++ b/sys-libs/slang/files/slang-1.4.9-autoconf.dif
@@ -0,0 +1,149 @@
+--- autoconf/configure.in.old 2002-09-13 13:53:56.000000000 +0200
++++ autoconf/configure.in 2002-09-13 14:01:44.000000000 +0200
+@@ -17,6 +17,62 @@
+ AC_CONFIG_AUX_DIR(autoconf)
+ AC_CANONICAL_HOST
+
++AH_TOP([
++/* -*- c -*- */
++/* Note: this is for unix only. */
++
++#ifndef SL_CONFIG_H
++#define SL_CONFIG_H
++])
++
++AH_BOTTOM([
++#if defined(HAVE_SIGADDSET) && defined(HAVE_SIGEMPTYSET)
++# if defined(HAVE_SIGACTION) && defined(HAVE_SIGPROCMASK)
++# define SLANG_POSIX_SIGNALS
++# endif
++#endif
++
++/* Define if you need to in order for stat and other things to work. */
++#undef _POSIX_SOURCE
++
++#ifdef _AIX
++# ifndef _POSIX_SOURCE
++# define _POSIX_SOURCE 1
++# endif
++# ifndef _ALL_SOURCE
++# define _ALL_SOURCE
++# endif
++/* This may generate warnings but the fact is that without it, xlc will
++ * INCORRECTLY inline many str* functions. */
++# undef __STR__
++#endif
++
++/* define USE_TERMCAP if you want to use it instead of terminfo. */
++#if defined(sequent) || defined(NeXT)
++# ifndef USE_TERMCAP
++# define USE_TERMCAP
++# endif
++#endif
++
++#if defined(ultrix) && !defined(__GNUC__)
++# ifndef NO_PROTOTYPES
++# define NO_PROTOTYPES
++# endif
++#endif
++
++#ifndef unix
++# define unix 1
++#endif
++
++#ifndef __unix__
++# define __unix__ 1
++#endif
++
++#define _SLANG_SOURCE_ 1
++#endif /* SL_CONFIG_H */
++])
++
++
+ JD_INIT
+ JD_ANSI_CC
+
+@@ -69,9 +125,9 @@
+ times gmtime \
+ )
+
+-AC_CHECK_LIB(m, acosh, [AC_DEFINE(HAVE_ACOSH)])
+-AC_CHECK_LIB(m, asinh, [AC_DEFINE(HAVE_ASINH)])
+-AC_CHECK_LIB(m, atanh, [AC_DEFINE(HAVE_ATANH)])
++AC_CHECK_LIB(m, acosh, [AC_DEFINE(HAVE_ACOSH,1,[Define to 1 if you have the `acosh' function])])
++AC_CHECK_LIB(m, asinh, [AC_DEFINE(HAVE_ASINH,1,[Define to 1 if you have the `asinh' function])])
++AC_CHECK_LIB(m, atanh, [AC_DEFINE(HAVE_ATANH,1,[Define to 1 if you have the `atanh' function])])
+
+ JD_ELF_COMPILER
+ JD_IEEE_CFLAGS
+--- autoconf/aclocal.m4.old 2002-09-13 13:35:17.000000000 +0200
++++ autoconf/aclocal.m4 2002-09-13 14:16:10.000000000 +0200
+@@ -258,18 +258,18 @@
+ AC_DEFUN(JD_GCC_WARNINGS,
+ [
+ AC_ARG_ENABLE(warnings,
+- [ --enable-warnings turn on GCC compiler warnings],
++ AC_HELP_STRING([--enable-warnings],[turn on GCC compiler warnings]),
+ [gcc_warnings=$enableval])
+-if test -n "$GCC"
++if test -n "$GCC" && test -n "$gcc_warnings"
+ then
+- CFLAGS="$CFLAGS -fno-strength-reduce"
+- if test -n "$gcc_warnings"
+- then
+- CFLAGS="$CFLAGS -Wall -W -pedantic -Winline -Wmissing-prototypes \
+- -Wnested-externs -Wpointer-arith -Wcast-align -Wshadow -Wstrict-prototypes"
+- # Now trim excess whitespace
+- CFLAGS=`echo $CFLAGS`
+- fi
++ CFLAGS="$CFLAGS -Wall -W -pedantic -Winline -Wmissing-prototypes \
++ -Wnested-externs -Wpointer-arith -Wcast-align -Wshadow -Wstrict-prototypes \
++ -Wformat -Wformat-security"
++ ELF_CFLAGS="$ELF_CFLAGS -Wall -W -pedantic -Winline -Wmissing-prototypes \
++ -Wnested-externs -Wpointer-arith -Wcast-align -Wshadow -Wstrict-prototypes \
++ -Wformat -Wformat-security"
++ # Now trim excess whitespace
++ CFLAGS=`echo $CFLAGS`
+ fi
+ ])
+
+@@ -415,7 +415,7 @@
+ done
+ if test "$TERMCAP"; then
+ AC_MSG_RESULT(no)
+- AC_DEFINE(USE_TERMCAP)
++ AC_DEFINE(USE_TERMCAP,1,[Define to use termcap])
+ fi
+ AC_SUBST(TERMCAP)dnl
+ AC_SUBST(MISC_TERMINFO_DIRS)dnl
+@@ -439,7 +439,7 @@
+ yes
+ #endif
+ ], [
+-AC_DEFINE(_HPUX_SOURCE)
++AC_DEFINE(_HPUX_SOURCE,1,[Special define needed for HPUX])
+ if test "$CC" = cc; then CC="cc -Ae"; fi
+ ])dnl
+ dnl
+@@ -462,8 +462,11 @@
+ dnl # Check for dynamic linker
+ dnl #-------------------------------------------------------------------------
+ DYNAMIC_LINK_LIB=""
++
++AH_TEMPLATE([HAVE_DLOPEN],[Define if you have dlopen])
++
+ AC_CHECK_HEADER(dlfcn.h,[
+- AC_DEFINE(HAVE_DLFCN_H)
++ AC_DEFINE(HAVE_DLFCN_H,1,[Define if you have the dlfcn.h header])
+ AC_CHECK_LIB(dl,dlopen,[
+ DYNAMIC_LINK_LIB="-ldl"
+ AC_DEFINE(HAVE_DLOPEN)
+@@ -484,7 +487,7 @@
+ *linux* )
+ DYNAMIC_LINK_FLAGS="-Wl,-export-dynamic"
+ ELF_CC="gcc"
+- ELF_CFLAGS="-O2 -fno-strength-reduce -fPIC"
++ ELF_CFLAGS="$ELF_CFLAGS -fPIC"
+ ELF_LINK="gcc -shared -Wl,-soname#"
+ ELF_LINK_CMD="\$(ELF_LINK),\$(ELFLIB_MAJOR)"
+ ELF_DEP_LIBS="\$(DL_LIB) -lm -lc"
diff --git a/sys-libs/slang/files/slang-1.4.9-fsuid.dif b/sys-libs/slang/files/slang-1.4.9-fsuid.dif
new file mode 100644
index 000000000000..23c8e1fa66f1
--- /dev/null
+++ b/sys-libs/slang/files/slang-1.4.9-fsuid.dif
@@ -0,0 +1,31 @@
+--- autoconf/configure.in.setfsuid 2002-09-13 15:30:56.000000000 +0200
++++ autoconf/configure.in 2002-09-13 15:35:56.000000000 +0200
+@@ -94,8 +94,17 @@
+ sys/wait.h \
+ sys/utsname.h \
+ sys/times.h \
++sys/fsuid.h \
+ )
+
++AC_CHECK_FUNCS(setfsuid setfsgid)
++
++if test "${ac_cv_func_setfsuid}" != "yes" || test "${ac_cv_func_setfsgid}" != "yes"; then
++ AC_MSG_ERROR([
++*** setfsguid and setfsgid cannot be found!!!
++ These are needed to support setuid/setgid applications ***])
++fi
++
+ AC_TYPE_MODE_T
+ AC_TYPE_PID_T
+ AC_TYPE_UID_T
+--- src.old/slinclud.h 2002-09-13 14:17:04.000000000 +0200
++++ src/slinclud.h 2002-09-13 15:39:38.000000000 +0200
+@@ -30,4 +30,8 @@
+ #include <wchar.h>
+ #include <limits.h>
+
++#ifdef HAVE_SYS_FSUID_H
++# include <sys/fsuid.h>
++#endif
++
+ #endif /* _SLANG_INCLUDE_H_ */
diff --git a/sys-libs/slang/files/slang-1.4.9.dif b/sys-libs/slang/files/slang-1.4.9.dif
new file mode 100644
index 000000000000..ea32f46be479
--- /dev/null
+++ b/sys-libs/slang/files/slang-1.4.9.dif
@@ -0,0 +1,72 @@
+--- src/sldisply.c
++++ src/sldisply.c
+@@ -2156,6 +2156,13 @@
+ Term_Init_Str = SLtt_tgetstr ("ti");
+ Term_Reset_Str = SLtt_tgetstr ("te");
+
++# ifndef USE_TERMCAP
++ /* Use the given terminal specification of the terminfo entries
++ * even if we have almost vtxxx.
++ */
++ Keypad_Init_Str = SLtt_tgetstr ("ks");
++ Keypad_Reset_Str = SLtt_tgetstr ("ke");
++# else
+ /* If I do this for vtxxx terminals, arrow keys start sending ESC O A,
+ * which I do not want. This is mainly for HP terminals.
+ */
+@@ -2164,6 +2171,7 @@
+ Keypad_Init_Str = SLtt_tgetstr ("ks");
+ Keypad_Reset_Str = SLtt_tgetstr ("ke");
+ }
++#endif
+
+ /* Make up for defective termcap/terminfo databases */
+ if ((Vt100_Like && (term[2] != '1'))
+@@ -2351,10 +2359,12 @@
+ /* specific to vtxxx only */
+ void SLtt_enable_cursor_keys (void)
+ {
++#if 0
+ #ifdef __unix__
+ if (Vt100_Like)
+ #endif
+ tt_write_string("\033=\033[?1l");
++#endif
+ }
+
+ #ifdef VMS
+--- src/sltermin.c
++++ src/sltermin.c
+@@ -105,7 +105,32 @@
+ * I will also look into the use of setreuid, seteuid and setregid, setegid.
+ * FIXME: Priority=medium
+ */
++ /* If your system lacks setfsuid/getfsuid either write
++ equivalent support or dont use slang to build setuid/setgid
++ apps like Mutt */
++
++ if(setfsuid(getuid())==-1)
++ {
++ perror("setfsuid");
++ return NULL;
++ }
++ if(setfsgid(getgid())==-1)
++ {
++ perror("setfsgid");
++ return NULL;
++ }
+ fp = fopen (file, "rb");
++ if(setfsuid(geteuid())==-1)
++ {
++ perror("setfsuid");
++ return NULL;
++ }
++ if(setfsgid(getegid())==-1)
++ {
++ perror("setfsgid");
++ return NULL;
++ }
++
+ if (fp == NULL) return NULL;
+
+ if ((12 == fread ((char *) buf, 1, 12, fp) && (MAGIC == make_integer (buf))))
diff --git a/sys-libs/slang/files/slang-debian-utf8.patch b/sys-libs/slang/files/slang-debian-utf8.patch
new file mode 100644
index 000000000000..62eb67056bf7
--- /dev/null
+++ b/sys-libs/slang/files/slang-debian-utf8.patch
@@ -0,0 +1,917 @@
+--- slang-1.4.4.orig/src/slinclud.h
++++ slang-1.4.4/src/slinclud.h
+@@ -23,4 +23,12 @@
+ # include <memory.h>
+ #endif
+
++#define UTF8 1
++
++#ifdef UTF8
++#include <wchar.h>
++#include <limits.h>
++#endif /* UTF8 */
++
++
+ #endif /* _SLANG_INCLUDE_H_ */
+--- slang-1.4.4.orig/src/slang.h
++++ slang-1.4.4/src/slang.h
+@@ -1239,10 +1239,20 @@
+ extern int SLtt_Msdos_Cheap_Video;
+ #endif
+
++#define UTF8 1
++
++#ifdef UTF8
++typedef int SLsmg_Char_Type;
++#define SLSMG_EXTRACT_CHAR(x) ((x) & 0xFFFFFF)
++#define SLSMG_EXTRACT_COLOR(x) (((x)>>24)&0xFF)
++#define SLSMG_BUILD_CHAR(ch,color) (((SLsmg_Char_Type)(wchar_t)(ch))|((color)<<24))
++#define SLSMG_NOCHAR 1
++#else
+ typedef unsigned short SLsmg_Char_Type;
+ #define SLSMG_EXTRACT_CHAR(x) ((x) & 0xFF)
+ #define SLSMG_EXTRACT_COLOR(x) (((x)>>8)&0xFF)
+ #define SLSMG_BUILD_CHAR(ch,color) (((SLsmg_Char_Type)(unsigned char)(ch))|((color)<<8))
++#endif /* UTF8 */
+
+ extern int SLtt_flush_output (void);
+ extern void SLtt_set_scroll_region(int, int);
+@@ -1334,7 +1342,11 @@
+
+ /*{{{ SLsmg Screen Management Functions */
+
++#ifdef UTF8
++extern void SLsmg_fill_region (int, int, unsigned int, unsigned int, wchar_t);
++#else
+ extern void SLsmg_fill_region (int, int, unsigned int, unsigned int, unsigned char);
++#endif /* UTF8 */
+ extern void SLsmg_set_char_set (int);
+ #ifndef IBMPC_SYSTEM
+ extern int SLsmg_Scroll_Hash_Border;
+@@ -1351,7 +1363,12 @@
+ extern void SLsmg_vprintf (char *, va_list);
+ extern void SLsmg_write_string (char *);
+ extern void SLsmg_write_nstring (char *, unsigned int);
++#ifdef UTF8
++extern void SLsmg_write_char (wchar_t);
++extern void SLsmg_write_nwchars (wchar_t *, unsigned int);
++#else
+ extern void SLsmg_write_char (char);
++#endif /* UTF8 */
+ extern void SLsmg_write_nchars (char *, unsigned int);
+ extern void SLsmg_write_wrapped_string (char *, int, int, unsigned int, unsigned int, int);
+ extern void SLsmg_cls (void);
+--- slang-1.4.4.orig/src/slcurses.c
++++ slang-1.4.4/src/slcurses.c
+@@ -440,20 +440,130 @@
+
+ static int do_newline (SLcurses_Window_Type *w)
+ {
+- w->_curx = 0;
++ /* w->_curx = 0; */
+ w->_cury += 1;
+ if (w->_cury >= w->scroll_max)
+ {
+ w->_cury = w->scroll_max - 1;
+- if (w->scroll_ok)
++ if (w->scroll_ok) {
++ w->_curx = 0;
+ SLcurses_wscrl (w, 1);
++ }
+ }
++ else
++ w->_curx = 0;
++
++ return 0;
++}
++
++#ifdef UTF8
++static int SLcurses_waddch1 (SLcurses_Window_Type *win,
++ wchar_t ch, int color)
++{
++ SLsmg_Char_Type *b, *bmin, *bmax, *c;
++ int k;
++
++ if (win == NULL) return -1;
++
++ if (win->_cury >= win->nrows)
++ {
++ /* Curses seems to move current postion to top of window. */
++ win->_cury = win->_curx = 0;
++ return -1;
++ }
++
++ win->modified = 1;
++
++ if (ch < ' ')
++ {
++ if (ch == '\n')
++ {
++ SLcurses_wclrtoeol (win);
++ return do_newline (win);
++ }
++
++ if (ch == '\r')
++ {
++ win->_curx = 0;
++ return 0;
++ }
++
++ if (ch == '\b')
++ {
++ if (win->_curx > 0)
++ win->_curx--;
++
++ return 0;
++ }
++
++ /* HACK HACK!!!! */
++ if (ch == '\t') ch = ' ';
++ }
++
++ k = wcwidth(ch);
++
++ if (!k)
++ return 0; /* ignore combining characters for now */
++
++ if (k > win->ncols)
++ return 0; /* character wider than window */
++
++ if (win->_curx + k > win->ncols) {
++ if (win->_curx < win->ncols)
++ SLcurses_wclrtoeol(win);
++ do_newline (win);
++ }
++
++ bmin = win->lines[win->_cury];
++ b = bmin + win->_curx;
++ bmax = bmin + win->ncols;
++
++ /* Remove overwritten chars to left */
++ if (*b == SLSMG_NOCHAR) {
++ for (c = b - 1; c >= bmin && *c == SLSMG_NOCHAR; c--)
++ *c = SLSMG_BUILD_CHAR(' ',SLSMG_EXTRACT_COLOR(*c));
++ if (c >= bmin)
++ *c = SLSMG_BUILD_CHAR(' ',SLSMG_EXTRACT_COLOR(*c));
++ }
++
++ *b = SLSMG_BUILD_CHAR(ch,color);
++ win->_curx += k;
++ while (--k > 0)
++ *++b = SLSMG_NOCHAR;
++
++ /* Remove overwritten chars to right */
++ for (c = b + 1; c < bmax && *c == SLSMG_NOCHAR; c++)
++ *c = SLSMG_BUILD_CHAR(' ',SLSMG_EXTRACT_COLOR(*c));
+
+ return 0;
+ }
+
+ int SLcurses_waddch (SLcurses_Window_Type *win, SLtt_Char_Type attr)
+ {
++ SLsmg_Char_Type ch, color;
++
++ if (win == NULL) return -1;
++
++ ch = SLSMG_EXTRACT_CHAR(attr);
++
++ if (attr == ch)
++ color = win->color;
++ else
++ {
++ /* hack to pick up the default color for graphics chars */
++ if (((attr & A_COLOR) == 0) && ((attr & A_ALTCHARSET) != 0))
++ {
++ /* FIXME: priority=medium: Use SLSMG_?? instead of << */
++ attr |= win->color << 8;
++ }
++ color = map_attr_to_object (attr);
++ }
++
++ return SLcurses_waddch1 (win, ch, color);
++}
++#else
++int SLcurses_waddch (SLcurses_Window_Type *win, SLtt_Char_Type attr)
++{
+ SLsmg_Char_Type *b, ch;
+ SLsmg_Char_Type color;
+
+@@ -518,6 +628,7 @@
+
+ return 0;
+ }
++#endif /* UTF8 */
+
+ int SLcurses_wnoutrefresh (SLcurses_Window_Type *w)
+ {
+@@ -577,7 +688,11 @@
+
+ int SLcurses_wclrtoeol (SLcurses_Window_Type *w)
+ {
++#ifdef UTF8
++ SLsmg_Char_Type *b, *bmin, *bmax, *c;
++#else
+ SLsmg_Char_Type *b, *bmax;
++#endif /* UTF8 */
+ SLsmg_Char_Type blank;
+
+ if (w == NULL) return -1;
+@@ -588,9 +703,23 @@
+
+ blank = SLSMG_BUILD_CHAR(' ',w->color);
+
++#ifdef UTF8
++ bmin = w->lines[w->_cury];
++ b = bmin + w->_curx;
++ bmax = bmin + w->ncols;
++
++ /* Remove overwritten chars to left */
++ if (b < bmax && *b == SLSMG_NOCHAR) {
++ for (c = b - 1; c >= bmin && *c == SLSMG_NOCHAR; c--)
++ *c = SLSMG_BUILD_CHAR(' ',SLSMG_EXTRACT_COLOR(*c));
++ if (c >= bmin)
++ *c = SLSMG_BUILD_CHAR(' ',SLSMG_EXTRACT_COLOR(*c));
++ }
++#else
+ b = w->lines[w->_cury];
+ bmax = b + w->ncols;
+ b += w->_curx;
++#endif /* UTF8 */
+
+ while (b < bmax) *b++ = blank;
+ return 0;
+@@ -677,6 +806,34 @@
+ return 0;
+ }
+
++#ifdef UTF8
++/* Note: if len is < 0, entire string will be used.
++ */
++int SLcurses_waddnstr (SLcurses_Window_Type *w, char *str, int len)
++{
++ size_t k;
++ wchar_t wc;
++ mbstate_t mbstate;
++
++ if ((w == NULL)
++ || (str == NULL))
++ return -1;
++
++ if (len < 0)
++ len = (char *)(-1) - str;
++
++ memset (&mbstate, 0, sizeof (mbstate));
++ while ((k = mbrtowc (&wc, str, len, &mbstate)) &&
++ k != (size_t)(-1) &&
++ k != (size_t)(-2))
++ {
++ SLcurses_waddch1 (w, wc, w->color);
++ str += k;
++ len -= k;
++ }
++ return k;
++}
++#else
+ /* Note: if len is < 0, entire string will be used.
+ */
+ int SLcurses_waddnstr (SLcurses_Window_Type *w, char *str, int len)
+@@ -758,6 +915,7 @@
+
+ return 0;
+ }
++#endif /* UTF8 */
+
+ /* This routine IS NOT CORRECT. It needs to compute the proper overlap
+ * and copy accordingly. Here, I just assume windows are same size.
+@@ -852,12 +1010,36 @@
+
+ int SLcurses_wdelch (SLcurses_Window_Type *w)
+ {
++#ifdef UTF8
++ SLsmg_Char_Type *p, *p1, *pmin, *pmax, *q;
++#else
+ SLsmg_Char_Type *p, *p1, *pmax;
++#endif /* UTF8 */
+
++#ifdef UTF8
++ pmin = w->lines[w->_cury];
++ p = pmin + w->_curx;
++ pmax = pmin + w->ncols;
++
++ /* Remove overwritten chars to left */
++ if (p < pmax && *p == SLSMG_NOCHAR) {
++ for (q = p - 1; q >= pmin && *q == SLSMG_NOCHAR; q--)
++ *q = SLSMG_BUILD_CHAR(' ',SLSMG_EXTRACT_COLOR(*q));
++ if (q >= pmin)
++ *q = SLSMG_BUILD_CHAR(' ',SLSMG_EXTRACT_COLOR(*q));
++ }
++
++ /* Remove overwritten chars to right */
++ for (q = p + 1; q < pmax && *q == SLSMG_NOCHAR; q++)
++ *q = SLSMG_BUILD_CHAR(' ',SLSMG_EXTRACT_COLOR(*q));
++
++ p1 = p + 1;
++#else
+ p = w->lines[w->_cury];
+ pmax = p + w->ncols;
+ p += w->_curx;
+ p1 = p + 1;
++#endif /* UTF8 */
+
+ while (p1 < pmax)
+ {
+@@ -884,12 +1066,12 @@
+
+ while (pmax > p)
+ {
+- *pmax = *p1;
++ *pmax = *p1; /* Doesn't this assign beyond the end of the line? */
+ pmax = p1;
+ p1--;
+ }
+
+- if (p < pmax)
++ if (p < pmax) /* How could it be? */
+ *p = SLSMG_BUILD_CHAR(ch, w->color);
+
+ w->modified = 1;
+--- slang-1.4.4.orig/src/slsmg.c
++++ slang-1.4.4/src/slsmg.c
+@@ -225,6 +225,38 @@
+ SLsmg_write_nchars (str, strlen (str));
+ }
+
++#ifdef UTF8
++void SLsmg_write_nstring (char *str, unsigned int n)
++{
++ char blank = ' ';
++ mbstate_t mbstate;
++
++ /* Avoid a problem if a user accidently passes a negative value */
++ if ((int) n < 0)
++ return;
++
++ if (str != NULL)
++ {
++ wchar_t wc;
++ size_t k;
++ int w;
++
++ memset (&mbstate, 0, sizeof (mbstate));
++ while ((k = mbrtowc (&wc, str, MB_LEN_MAX, &mbstate)) &&
++ k != (size_t)(-1) &&
++ k != (size_t)(-2))
++ {
++ w = wcwidth(wc);
++ if (w < 0 || w > n)
++ break;
++ SLsmg_write_nwchars (&wc, 1);
++ str += k;
++ n -= w;
++ }
++ }
++ while (n-- > 0) SLsmg_write_nchars (&blank, 1);
++}
++#else
+ void SLsmg_write_nstring (char *str, unsigned int n)
+ {
+ unsigned int width;
+@@ -243,7 +275,11 @@
+ }
+ while (width++ < n) SLsmg_write_nchars (&blank, 1);
+ }
++#endif /* UTF8 */
+
++#ifdef UTF8
++/* FIXME: This function not UTF8'd yet - Edmund */
++#endif /* UTF8 */
+ void SLsmg_write_wrapped_string (char *s, int r, int c,
+ unsigned int dr, unsigned int dc,
+ int fill)
+@@ -302,6 +338,123 @@
+ int SLsmg_Display_Eight_Bit = 128;
+ #endif
+
++#ifdef UTF8
++void SLsmg_write_nwchars (wchar_t *str, unsigned int n)
++{
++ SLsmg_Char_Type *p, *prev, *q;
++ int len, max_len, w, i;
++ wchar_t ch;
++
++#ifndef IBMPC_SYSTEM
++ int alt_char_set_flag;
++
++ alt_char_set_flag = ((This_Color & ALT_CHAR_FLAG)
++ && ((tt_Use_Blink_For_ACS == NULL)
++ || (*tt_Use_Blink_For_ACS == 0)));
++#endif
++
++ if (Smg_Inited == 0)
++ return;
++ if (This_Row < Start_Row || This_Row >= Start_Row + Screen_Rows)
++ return;
++
++ max_len = Start_Col + Screen_Cols;
++ len = This_Col;
++ p = SL_Screen[This_Row - Start_Row].neew + len - Start_Col;
++ prev = 0;
++
++ for (i = 0; i < n; i++, str) {
++ ch = *str++;
++#ifndef IBMPC_SYSTEM
++ if (alt_char_set_flag)
++ ch = Alt_Char_Set[ch & 0x7F];
++#endif
++ w = wcwidth(ch);
++
++ if (w > 0) {
++ if (len + w <= max_len) {
++ if (!prev) {
++ for (q = p; *q == SLSMG_NOCHAR; q--)
++ *q = SLSMG_BUILD_CHAR(' ', SLSMG_EXTRACT_COLOR(*q));
++ *q = SLSMG_BUILD_CHAR(' ', SLSMG_EXTRACT_COLOR(*q));
++ }
++ prev = p;
++ *p++ = SLSMG_BUILD_CHAR(ch, This_Color), ++len;
++ for (; --w; len++, p++)
++ *p = SLSMG_NOCHAR;
++ }
++ else if (len < max_len) {
++ for (; len < max_len; len++, p++)
++ *p = SLSMG_BUILD_CHAR(' ', SLSMG_EXTRACT_COLOR(*p));
++ prev = 0;
++ }
++ }
++ else if (ch == '\n' &&
++ SLsmg_Newline_Behavior != SLSMG_NEWLINE_PRINTABLE) {
++ SL_Screen[This_Row - Start_Row].flags |= TOUCHED;
++ for (; len < max_len && *p == SLSMG_NOCHAR; len++, p++)
++ *p = SLSMG_BUILD_CHAR(' ', SLSMG_EXTRACT_COLOR(*p));
++ if (!SLsmg_Newline_Behavior)
++ break;
++ ++This_Row;
++ len = 0;
++ if (This_Row == Start_Row + Screen_Rows) {
++ if (SLsmg_Newline_Behavior == SLSMG_NEWLINE_SCROLLS)
++ scroll_up();
++ else
++ break;
++ }
++ p = SL_Screen[This_Row - Start_Row].neew;
++ prev = 0;
++ }
++ else if (ch == '\t' && (SLsmg_Tab_Width > 0)) {
++ while (len < max_len) {
++ *p = SLSMG_BUILD_CHAR(' ', SLSMG_EXTRACT_COLOR(*p));
++ ++p, ++len;
++ if (len % SLsmg_Tab_Width == 0)
++ break;
++ }
++ }
++ else if ((ch == 0x8) && SLsmg_Backspace_Moves) {
++ /* not implemented */
++ }
++ else if (!w && ch) {
++ /* we could handle combining characters here, using prev */
++ }
++ else {
++ /* we should convert control characters to printable form here */
++ }
++ }
++ This_Col = len;
++ if (i == n) {
++ SL_Screen[This_Row - Start_Row].flags |= TOUCHED;
++ for (; len < max_len && *p == SLSMG_NOCHAR; len++, p++)
++ *p = SLSMG_BUILD_CHAR(' ', SLSMG_EXTRACT_COLOR(*p));
++ }
++}
++
++void SLsmg_write_char (wchar_t wc)
++{
++ SLsmg_write_nwchars (&wc, 1);
++}
++
++void SLsmg_write_nchars (char *str, unsigned int n)
++{
++ wchar_t wc;
++ size_t k;
++ mbstate_t mbstate;
++
++ memset (&mbstate, 0, sizeof (mbstate));
++ while ((k = mbrtowc (&wc, str, n, &mbstate)) &&
++ k != (size_t)(-1) &&
++ k != (size_t)(-2))
++ {
++ SLsmg_write_nwchars (&wc, 1);
++ str += k;
++ n -= k;
++ }
++}
++#else
+ void SLsmg_write_nchars (char *str, unsigned int n)
+ {
+ register SLsmg_Char_Type *p, old, neew, color;
+@@ -475,6 +628,7 @@
+ {
+ SLsmg_write_nchars (&ch, 1);
+ }
++#endif /* UTF8 */
+
+ static int Cls_Flag;
+
+@@ -891,6 +1045,10 @@
+ This_Color = color;
+ }
+
++#ifdef UTF8
++ /* FIXME: We should convert broken wide characters to spaces
++ before calling smart_puts */
++#endif /* UTF8 */
+ SL_Screen[i].old[Screen_Cols] = 0;
+ SL_Screen[i].neew[Screen_Cols] = 0;
+
+@@ -1334,9 +1492,16 @@
+ This_Row = r; This_Col = c;
+ }
+
++#ifdef UTF8
++void SLsmg_fill_region (int r, int c, unsigned int dr, unsigned int dc, wchar_t ch)
++{
++ static wchar_t hbuf[16];
++ int i;
++#else
+ void SLsmg_fill_region (int r, int c, unsigned int dr, unsigned int dc, unsigned char ch)
+ {
+ static unsigned char hbuf[16];
++#endif /* UTF8 */
+ int count;
+ int dcmax, rmax;
+
+@@ -1357,16 +1522,30 @@
+ #if 0
+ ch = Alt_Char_Set[ch];
+ #endif
++#ifdef UTF8
++ if (ch != hbuf[0])
++ for (i = 0; i < 16; i++)
++ hbuf[i] = ch;
++#else
+ if (ch != hbuf[0]) SLMEMSET ((char *) hbuf, (char) ch, 16);
++#endif /* UTF8 */
+
+ for (This_Row = r; This_Row < rmax; This_Row++)
+ {
+ This_Col = c;
+ count = dc / 16;
++#ifdef UTF8
++ SLsmg_write_nwchars (hbuf, dc % 16);
++#else
+ SLsmg_write_nchars ((char *) hbuf, dc % 16);
++#endif /* UTF8 */
+ while (count-- > 0)
+ {
++#ifdef UTF8
++ SLsmg_write_nwchars (hbuf, 16);
++#else
+ SLsmg_write_nchars ((char *) hbuf, 16);
++#endif /* UTF8 */
+ }
+ }
+
+@@ -1381,14 +1560,22 @@
+ void SLsmg_write_color_chars (SLsmg_Char_Type *s, unsigned int len)
+ {
+ SLsmg_Char_Type *smax, sh;
++#ifdef UTF8
++ wchar_t buf[32], *b, *bmax;
++#else
+ char buf[32], *b, *bmax;
++#endif /* UTF8 */
+ int color, save_color;
+
+ if (Smg_Inited == 0) return;
+
+ smax = s + len;
+ b = buf;
++#ifdef UTF8
++ bmax = b + sizeof (buf) / sizeof (SLsmg_Char_Type);
++#else
+ bmax = b + sizeof (buf);
++#endif /* UTF8 */
+
+ save_color = This_Color;
+
+@@ -1412,16 +1599,28 @@
+ {
+ if (b != buf)
+ {
++#ifdef UTF8
++ SLsmg_write_nwchars (buf, (int) (b - buf));
++#else
+ SLsmg_write_nchars (buf, (int) (b - buf));
++#endif /* UTF8 */
+ b = buf;
+ }
+ This_Color = color;
+ }
++#ifdef UTF8
++ *b++ = SLSMG_EXTRACT_CHAR(sh);
++#else
+ *b++ = (char) SLSMG_EXTRACT_CHAR(sh);
++#endif /* UTF8 */
+ }
+
+ if (b != buf)
++#ifdef UTF8
++ SLsmg_write_nwchars (buf, (unsigned int) (b - buf));
++#else
+ SLsmg_write_nchars (buf, (unsigned int) (b - buf));
++#endif /* UTF8 */
+
+ This_Color = save_color;
+ }
+@@ -1473,7 +1672,11 @@
+ SLsmg_set_color_in_region (int color, int r, int c, unsigned int dr, unsigned int dc)
+ {
+ int cmax, rmax;
++#ifdef UTF8
++ int color_mask;
++#else
+ SLsmg_Char_Type char_mask;
++#endif /* UTF8 */
+
+ if (Smg_Inited == 0) return;
+
+@@ -1498,14 +1701,22 @@
+ color = ((color & 0x7F) + Bce_Color_Offset) & 0x7F;
+ }
+ #endif
++#ifdef UTF8
++ color_mask = 0;
++#else
+ color = color << 8;
+
+ char_mask = 0xFF;
++#endif /* UTF8 */
+
+ #ifndef IBMPC_SYSTEM
+ if ((tt_Use_Blink_For_ACS == NULL)
+ || (0 == *tt_Use_Blink_For_ACS))
++#ifdef UTF8
++ color_mask = 0x80;
++#else
+ char_mask = 0x80FF;
++#endif /* UTF8 */
+ #endif
+
+ while (r < rmax)
+@@ -1519,7 +1730,13 @@
+
+ while (s < smax)
+ {
++#ifdef UTF8
++ *s = SLSMG_BUILD_CHAR(SLSMG_EXTRACT_CHAR(*s),
++ (SLSMG_EXTRACT_COLOR(*s) & color_mask)
++ | color);
++#else
+ *s = (*s & char_mask) | color;
++#endif /* UTF8 */
+ s++;
+ }
+ r++;
+--- slang-1.4.5/src/Makefile.in.foo 2002-06-12 19:30:09.000000000 -0400
++++ slang-1.4.5/src/Makefile.in 2002-06-12 19:31:13.000000000 -0400
+@@ -67,7 +67,7 @@
+ #---------------------------------------------------------------------------
+ # There should be no need to change anything below here.
+ #---------------------------------------------------------------------------
+-THIS_LIB = slang#
++THIS_LIB = slang-utf8#
+ OTHERSTUFF =
+ THIS_LIB_DEFINES = -DSLANG
+ ELF_MAJOR_VERSION = @slang_major_version@#
+--- slang-1.4.9/src/sldisply.c.orig 2003-10-27 17:24:15.000000000 -0500
++++ slang-1.4.9/src/sldisply.c 2003-10-27 17:56:25.000000000 -0500
+@@ -9,6 +9,7 @@
+
+ #include <time.h>
+ #include <ctype.h>
++#include <limits.h>
+
+ #if !defined(VMS) || (__VMS_VER >= 70000000)
+ # include <sys/time.h>
+@@ -1426,14 +1427,25 @@
+
+ /* Highest bit represents the character set. */
+ #define COLOR_MASK 0x7F00
++#ifdef UTF8
++# define COLOR_OF(x) (SLSMG_EXTRACT_COLOR(x) & 0x7F)
++#else
+ #define COLOR_OF(x) (((x)&COLOR_MASK)>>8)
++#endif
+ #define CHAR_OF(x) ((x)&0x80FF)
+
+ #if SLTT_HAS_NON_BCE_SUPPORT
++#ifdef UTF8
++static int bce_color_eqs (SLsmg_Char_Type a, SLsmg_Char_Type b)
++{
++ a = SLSMG_EXTRACT_COLOR(a) & 0x7F;
++ b = SLSMG_EXTRACT_COLOR(b) & 0x7F;
++#else
+ static int bce_color_eqs (unsigned int a, unsigned int b)
+ {
+ a = COLOR_OF(a);
+ b = COLOR_OF(b);
++#endif
+
+ if (a == b)
+ return 1;
+@@ -1459,8 +1471,14 @@
+ : (Ansi_Color_Map[COLOR_OF(a)].mono == Ansi_Color_Map[COLOR_OF(b)].mono))
+ #endif
+
++#ifdef UTF8
++#define CHAR_EQS(a, b) ((a) == (b)\
++ || (SLSMG_EXTRACT_CHAR(a) == SLSMG_EXTRACT_CHAR(b)\
++ && COLOR_EQS((a), (b))))
++#else
+ #define CHAR_EQS(a, b) (((a) == (b))\
+ || ((CHAR_OF(a)==CHAR_OF(b)) && COLOR_EQS(a,b)))
++#endif
+
+ /* The whole point of this routine is to prevent writing to the last column
+ * and last row on terminals with automatic margins.
+@@ -1488,9 +1506,58 @@
+ tt_write (str, len);
+ }
+
++#ifdef UTF8
++/* FIXME: This duplicates the function above
++ */
++static void write_wstring_with_care (SLsmg_Char_Type *str, unsigned int len)
++{
++ mbstate_t mbstate;
++
++ if (str == NULL) return;
++
++ if (Automatic_Margins && (Cursor_r + 1 == SLtt_Screen_Rows))
++ {
++ if (len + (unsigned int) Cursor_c >= (unsigned int) SLtt_Screen_Cols)
++ {
++ /* For now, just do not write there. Later, something more
++ * sophisticated will be implemented.
++ */
++ if (SLtt_Screen_Cols > Cursor_c)
++ {
++ len = SLtt_Screen_Cols - Cursor_c - 1;
++ while (len > 0 && str[len] == SLSMG_NOCHAR)
++ --len;
++ }
++ else len = 0;
++ }
++ }
++
++ memset (&mbstate, 0, sizeof (mbstate));
++ while (len--)
++ {
++ SLsmg_Char_Type c = *str++;
++ char buf[MB_LEN_MAX];
++ size_t n;
++
++ if (c == SLSMG_NOCHAR)
++ continue;
++
++ n = wcrtomb (buf, c, &mbstate);
++ if (n == (size_t)(-1))
++ break;
++
++ tt_write(buf, n);
++ }
++}
++#endif /* UTF8 */
++
+ static void send_attr_str (SLsmg_Char_Type *s)
+ {
++#ifdef UTF8
++ SLsmg_Char_Type out[SLTT_MAX_SCREEN_COLS], ch, *p;
++#else
+ unsigned char out[SLTT_MAX_SCREEN_COLS], ch, *p;
++#endif /* UTF8 */
+ register SLtt_Char_Type attr;
+ register SLsmg_Char_Type sh;
+ int color, last_color = -1;
+@@ -1498,8 +1565,13 @@
+ p = out;
+ while (0 != (sh = *s++))
+ {
++#ifdef UTF8
++ ch = SLSMG_EXTRACT_CHAR(sh);
++ color = SLSMG_EXTRACT_COLOR(sh);
++#else
+ ch = sh & 0xFF;
+ color = ((int) sh & 0xFF00) >> 8;
++#endif
+
+ #if SLTT_HAS_NON_BCE_SUPPORT
+ if (Bce_Color_Offset
+@@ -1511,8 +1583,12 @@
+ {
+ if (SLtt_Use_Ansi_Colors) attr = Ansi_Color_Map[color & 0x7F].fgbg;
+ else attr = Ansi_Color_Map[color & 0x7F].mono;
+-
++
++#ifdef UTF8
++ if (SLSMG_EXTRACT_COLOR(sh) & 0x80) /* alternate char set */
++#else
+ if (sh & 0x8000) /* alternate char set */
++#endif
+ {
+ if (SLtt_Use_Blink_For_ACS)
+ {
+@@ -1534,8 +1610,12 @@
+ {
+ if (p != out)
+ {
++#ifdef UTF8
++ write_wstring_with_care (out, p-out);
++#else
+ *p = 0;
+ write_string_with_care ((char *) out);
++#endif
+ Cursor_c += (int) (p - out);
+ p = out;
+ }
+@@ -1558,8 +1638,12 @@
+ }
+ *p++ = ch;
+ }
++#ifdef UTF8
++ if (p != out) write_wstring_with_care (out, p-out);
++#else
+ *p = 0;
+ if (p != out) write_string_with_care ((char *) out);
++#endif
+ Cursor_c += (int) (p - out);
+ }
+
+@@ -1686,7 +1770,11 @@
+
+ while (qq < qmax)
+ {
++#ifdef UTF8
++ if (SLSMG_EXTRACT_COLOR(*qq))
++#else
+ if (*qq & 0xFF00)
++#endif
+ {
+ SLtt_normal_video ();
+ SLtt_del_eol ();
+@@ -1701,7 +1789,11 @@
+ /* Find where the last non-blank character on old/new screen is */
+
+ space_char = ' ';
++#ifdef UTF8
++ if (SLSMG_EXTRACT_CHAR(*(pmax-1)) == ' ')
++#else
+ if (CHAR_EQS(*(pmax-1), ' '))
++#endif
+ {
+ /* If we get here, then we can erase to the end of the line to create
+ * the final space. However, this will only work _if_ erasing will
+@@ -1752,7 +1844,11 @@
+ {
+ #endif
+ /* Try use use erase to bol if possible */
++#ifdef UTF8
++ if ((Del_Bol_Str != NULL) && (SLSMG_EXTRACT_CHAR(*neww) == ' '))
++#else
+ if ((Del_Bol_Str != NULL) && (CHAR_OF(*neww) == ' '))
++#endif
+ {
+ SLsmg_Char_Type *p1;
+ SLsmg_Char_Type blank;
+@@ -1781,7 +1877,11 @@
+ q = oldd + ofs;
+ p = p1;
+ SLtt_goto_rc (row, ofs - 1);
++#ifdef UTF8
++ SLtt_reverse_video (SLSMG_EXTRACT_COLOR (blank));
++#else
+ SLtt_reverse_video (COLOR_OF(blank));
++#endif
+ tt_write_string (Del_Bol_Str);
+ tt_write (" ", 1);
+ Cursor_c += 1;
+@@ -1978,7 +2078,11 @@
+
+ if (q < qmax)
+ {
++#ifdef UTF8
++ SLtt_reverse_video (SLSMG_EXTRACT_COLOR (space_char));
++#else
+ SLtt_reverse_video (COLOR_OF(space_char));
++#endif
+ del_eol ();
+ }
+
diff --git a/sys-libs/slang/files/slang-utf8-acs.patch b/sys-libs/slang/files/slang-utf8-acs.patch
new file mode 100644
index 000000000000..dc8a8519a989
--- /dev/null
+++ b/sys-libs/slang/files/slang-utf8-acs.patch
@@ -0,0 +1,417 @@
+--- slang-1.4.5/src/slang.h.acs 2002-07-09 00:03:57.000000000 -0400
++++ slang-1.4.5/src/slang.h 2002-07-09 00:11:06.000000000 -0400
+@@ -1255,6 +1255,8 @@
+
+ #ifdef UTF8
+ typedef int SLsmg_Char_Type;
++extern SLtt_Char_Type SLcurses_Acs_Map [128];
++#define acs_map SLcurses_Acs_Map
+ #define SLSMG_EXTRACT_CHAR(x) ((x) & 0xFFFFFF)
+ #define SLSMG_EXTRACT_COLOR(x) (((x)>>24)&0xFF)
+ #define SLSMG_BUILD_CHAR(ch,color) (((SLsmg_Char_Type)(wchar_t)(ch))|((color)<<24))
+@@ -1396,7 +1398,11 @@
+ extern void SLsmg_set_screen_start (int *, int *);
+ extern void SLsmg_draw_hline (unsigned int);
+ extern void SLsmg_draw_vline (int);
++#ifdef UTF8
++extern void SLsmg_draw_object (int, int, SLsmg_Char_Type);
++#else
+ extern void SLsmg_draw_object (int, int, unsigned char);
++#endif
+ extern void SLsmg_draw_box (int, int, unsigned int, unsigned int);
+ extern int SLsmg_get_column(void);
+ extern int SLsmg_get_row(void);
+@@ -1408,6 +1414,9 @@
+ extern int SLsmg_Display_Eight_Bit;
+ extern int SLsmg_Tab_Width;
+
++extern int SLsmg_Is_Unicode;
++extern int SLsmg_Setlocale;
++
+ #define SLSMG_NEWLINE_IGNORED 0 /* default */
+ #define SLSMG_NEWLINE_MOVES 1 /* moves to next line, column 0 */
+ #define SLSMG_NEWLINE_SCROLLS 2 /* moves but scrolls at bottom of screen */
+@@ -1465,31 +1474,79 @@
+ # define SLSMG_BOARD_CHAR '#'
+ # define SLSMG_BLOCK_CHAR '#'
+ # else
+-# define SLSMG_HLINE_CHAR 'q'
+-# define SLSMG_VLINE_CHAR 'x'
+-# define SLSMG_ULCORN_CHAR 'l'
+-# define SLSMG_URCORN_CHAR 'k'
+-# define SLSMG_LLCORN_CHAR 'm'
+-# define SLSMG_LRCORN_CHAR 'j'
+-# define SLSMG_CKBRD_CHAR 'a'
+-# define SLSMG_RTEE_CHAR 'u'
+-# define SLSMG_LTEE_CHAR 't'
+-# define SLSMG_UTEE_CHAR 'w'
+-# define SLSMG_DTEE_CHAR 'v'
+-# define SLSMG_PLUS_CHAR 'n'
+-# define SLSMG_DIAMOND_CHAR '`'
+-# define SLSMG_DEGREE_CHAR 'f'
+-# define SLSMG_PLMINUS_CHAR 'g'
+-# define SLSMG_BULLET_CHAR '~'
+-# define SLSMG_LARROW_CHAR ','
+-# define SLSMG_RARROW_CHAR '+'
+-# define SLSMG_DARROW_CHAR '.'
+-# define SLSMG_UARROW_CHAR '-'
+-# define SLSMG_BOARD_CHAR 'h'
+-# define SLSMG_BLOCK_CHAR '0'
++# define SLSMG_HLINE_CHAR (acs_map['q'])
++# define SLSMG_VLINE_CHAR (acs_map['x'])
++# define SLSMG_ULCORN_CHAR (acs_map['l'])
++# define SLSMG_URCORN_CHAR (acs_map['k'])
++# define SLSMG_LLCORN_CHAR (acs_map['m'])
++# define SLSMG_LRCORN_CHAR (acs_map['j'])
++# define SLSMG_CKBRD_CHAR (acs_map['a'])
++# define SLSMG_RTEE_CHAR (acs_map['u'])
++# define SLSMG_LTEE_CHAR (acs_map['t'])
++# define SLSMG_UTEE_CHAR (acs_map['v'])
++# define SLSMG_DTEE_CHAR (acs_map['w'])
++# define SLSMG_PLUS_CHAR (acs_map['n'])
++# define SLSMG_DIAMOND_CHAR (acs_map['`'])
++# define SLSMG_DEGREE_CHAR (acs_map['f'])
++# define SLSMG_PLMINUS_CHAR (acs_map['g'])
++# define SLSMG_BULLET_CHAR (acs_map['~'])
++# define SLSMG_LARROW_CHAR (acs_map[','])
++# define SLSMG_RARROW_CHAR (acs_map['+'])
++# define SLSMG_DARROW_CHAR (acs_map['.'])
++# define SLSMG_UARROW_CHAR (acs_map['-'])
++# define SLSMG_BOARD_CHAR (acs_map['h'])
++# define SLSMG_BLOCK_CHAR (acs_map['0'])
++#
++# define SLSMG_HLINE_CHAR_TERM 'q'
++# define SLSMG_VLINE_CHAR_TERM 'x'
++# define SLSMG_ULCORN_CHAR_TERM 'l'
++# define SLSMG_URCORN_CHAR_TERM 'k'
++# define SLSMG_LLCORN_CHAR_TERM 'm'
++# define SLSMG_LRCORN_CHAR_TERM 'j'
++# define SLSMG_CKBRD_CHAR_TERM 'a'
++# define SLSMG_RTEE_CHAR_TERM 'u'
++# define SLSMG_LTEE_CHAR_TERM 't'
++# define SLSMG_UTEE_CHAR_TERM 'v'
++# define SLSMG_DTEE_CHAR_TERM 'w'
++# define SLSMG_PLUS_CHAR_TERM 'n'
++# define SLSMG_DIAMOND_CHAR_TERM '`'
++# define SLSMG_DEGREE_CHAR_TERM 'f'
++# define SLSMG_PLMINUS_CHAR_TERM 'g'
++# define SLSMG_BULLET_CHAR_TERM '~'
++# define SLSMG_LARROW_CHAR_TERM ','
++# define SLSMG_RARROW_CHAR_TERM '+'
++# define SLSMG_DARROW_CHAR_TERM '.'
++# define SLSMG_UARROW_CHAR_TERM '-'
++# define SLSMG_BOARD_CHAR_TERM 'h'
++# define SLSMG_BLOCK_CHAR_TERM '0'
+ # endif /* AMIGA */
+ #endif /* IBMPC_SYSTEM */
+
++#ifdef UTF8
++# define SLSMG_HLINE_CHAR_UNICODE 0x2500
++# define SLSMG_VLINE_CHAR_UNICODE 0x2502
++# define SLSMG_ULCORN_CHAR_UNICODE 0x250c
++# define SLSMG_URCORN_CHAR_UNICODE 0x2510
++# define SLSMG_LLCORN_CHAR_UNICODE 0x2514
++# define SLSMG_LRCORN_CHAR_UNICODE 0x2518
++# define SLSMG_RTEE_CHAR_UNICODE 0x2524
++# define SLSMG_LTEE_CHAR_UNICODE 0x251c
++# define SLSMG_UTEE_CHAR_UNICODE 0x2534
++# define SLSMG_DTEE_CHAR_UNICODE 0x252c
++# define SLSMG_PLUS_CHAR_UNICODE 0x253c
++# define SLSMG_CKBRD_CHAR_UNICODE 0x2592
++# define SLSMG_DIAMOND_CHAR_UNICODE 0x25c6
++# define SLSMG_DEGREE_CHAR_UNICODE 0x00b0
++# define SLSMG_PLMINUS_CHAR_UNICODE 0x00b1
++# define SLSMG_BULLET_CHAR_UNICODE 0x00b7
++# define SLSMG_LARROW_CHAR_UNICODE 0x2190
++# define SLSMG_RARROW_CHAR_UNICODE 0x2192
++# define SLSMG_DARROW_CHAR_UNICODE 0x2193
++# define SLSMG_UARROW_CHAR_UNICODE 0x2191
++# define SLSMG_BOARD_CHAR_UNICODE 0x2592
++# define SLSMG_BLOCK_CHAR_UNICODE 0x25ae
++#endif
++
+ #ifndef IBMPC_SYSTEM
+ # define SLSMG_COLOR_BLACK 0x000000
+ # define SLSMG_COLOR_RED 0x000001
+--- slang-1.4.5/src/slcurses.c.acs 2002-07-09 00:03:57.000000000 -0400
++++ slang-1.4.5/src/slcurses.c 2002-07-09 00:09:03.000000000 -0400
+@@ -331,40 +331,63 @@
+ /* SLtt_set_mono (A_BLINK >> 8, NULL, SLTT_BLINK_MASK); */
+ SLtt_set_mono ((A_BOLD|A_UNDERLINE) >> 8, NULL, SLTT_ULINE_MASK|SLTT_BOLD_MASK);
+ SLtt_set_mono ((A_REVERSE|A_UNDERLINE) >> 8, NULL, SLTT_ULINE_MASK|SLTT_REV_MASK);
++
++ SLcurses_init_acs_map();
++
++ return SLcurses_Stdscr;
++}
+
++void SLcurses_init_acs_map()
++{
+ if (SLtt_Has_Alt_Charset)
+ {
+- SLcurses_Acs_Map[SLSMG_ULCORN_CHAR] = SLSMG_ULCORN_CHAR | A_ALTCHARSET;
+- SLcurses_Acs_Map[SLSMG_URCORN_CHAR] = SLSMG_URCORN_CHAR | A_ALTCHARSET;
+- SLcurses_Acs_Map[SLSMG_LLCORN_CHAR] = SLSMG_LLCORN_CHAR | A_ALTCHARSET;
+- SLcurses_Acs_Map[SLSMG_LRCORN_CHAR] = SLSMG_LRCORN_CHAR | A_ALTCHARSET;
+- SLcurses_Acs_Map[SLSMG_UTEE_CHAR] = SLSMG_UTEE_CHAR | A_ALTCHARSET;
+- SLcurses_Acs_Map[SLSMG_DTEE_CHAR] = SLSMG_DTEE_CHAR | A_ALTCHARSET;
+- SLcurses_Acs_Map[SLSMG_LTEE_CHAR] = SLSMG_LTEE_CHAR | A_ALTCHARSET;
+- SLcurses_Acs_Map[SLSMG_RTEE_CHAR] = SLSMG_RTEE_CHAR | A_ALTCHARSET;
+- SLcurses_Acs_Map[SLSMG_VLINE_CHAR] = SLSMG_VLINE_CHAR | A_ALTCHARSET;
+- SLcurses_Acs_Map[SLSMG_HLINE_CHAR] = SLSMG_HLINE_CHAR | A_ALTCHARSET;
+- SLcurses_Acs_Map[SLSMG_PLUS_CHAR] = SLSMG_PLUS_CHAR | A_ALTCHARSET;
+- SLcurses_Acs_Map[SLSMG_CKBRD_CHAR] = SLSMG_CKBRD_CHAR | A_ALTCHARSET;
++ if (SLsmg_Is_Unicode)
++ {
++ SLcurses_Acs_Map['l'] = SLSMG_ULCORN_CHAR_UNICODE;
++ SLcurses_Acs_Map['k'] = SLSMG_URCORN_CHAR_UNICODE;
++ SLcurses_Acs_Map['m'] = SLSMG_LLCORN_CHAR_UNICODE;
++ SLcurses_Acs_Map['j'] = SLSMG_LRCORN_CHAR_UNICODE;
++ SLcurses_Acs_Map['v'] = SLSMG_UTEE_CHAR_UNICODE;
++ SLcurses_Acs_Map['w'] = SLSMG_DTEE_CHAR_UNICODE;
++ SLcurses_Acs_Map['t'] = SLSMG_LTEE_CHAR_UNICODE;
++ SLcurses_Acs_Map['u'] = SLSMG_RTEE_CHAR_UNICODE;
++ SLcurses_Acs_Map['x'] = SLSMG_VLINE_CHAR_UNICODE;
++ SLcurses_Acs_Map['q'] = SLSMG_HLINE_CHAR_UNICODE;
++ SLcurses_Acs_Map['n'] = SLSMG_PLUS_CHAR_UNICODE;
++ SLcurses_Acs_Map['a'] = SLSMG_CKBRD_CHAR_UNICODE;
++ }
++ else
++ {
++ SLcurses_Acs_Map['l'] = SLSMG_ULCORN_CHAR_TERM | A_ALTCHARSET;
++ SLcurses_Acs_Map['k'] = SLSMG_URCORN_CHAR_TERM | A_ALTCHARSET;
++ SLcurses_Acs_Map['m'] = SLSMG_LLCORN_CHAR_TERM | A_ALTCHARSET;
++ SLcurses_Acs_Map['j'] = SLSMG_LRCORN_CHAR_TERM | A_ALTCHARSET;
++ SLcurses_Acs_Map['v'] = SLSMG_UTEE_CHAR_TERM | A_ALTCHARSET;
++ SLcurses_Acs_Map['w'] = SLSMG_DTEE_CHAR_TERM | A_ALTCHARSET;
++ SLcurses_Acs_Map['t'] = SLSMG_LTEE_CHAR_TERM | A_ALTCHARSET;
++ SLcurses_Acs_Map['u'] = SLSMG_RTEE_CHAR_TERM | A_ALTCHARSET;
++ SLcurses_Acs_Map['x'] = SLSMG_VLINE_CHAR_TERM | A_ALTCHARSET;
++ SLcurses_Acs_Map['q'] = SLSMG_HLINE_CHAR_TERM | A_ALTCHARSET;
++ SLcurses_Acs_Map['n'] = SLSMG_PLUS_CHAR_TERM | A_ALTCHARSET;
++ SLcurses_Acs_Map['a'] = SLSMG_CKBRD_CHAR_TERM | A_ALTCHARSET;
++ }
+ }
+ else
+ {
+ /* ugly defaults to use on terminals which don't support graphics */
+- SLcurses_Acs_Map[SLSMG_ULCORN_CHAR] = '+';
+- SLcurses_Acs_Map[SLSMG_URCORN_CHAR] = '+';
+- SLcurses_Acs_Map[SLSMG_LLCORN_CHAR] = '+';
+- SLcurses_Acs_Map[SLSMG_LRCORN_CHAR] = '+';
+- SLcurses_Acs_Map[SLSMG_UTEE_CHAR] = '+';
+- SLcurses_Acs_Map[SLSMG_DTEE_CHAR] = '+';
+- SLcurses_Acs_Map[SLSMG_LTEE_CHAR] = '+';
+- SLcurses_Acs_Map[SLSMG_RTEE_CHAR] = '+';
+- SLcurses_Acs_Map[SLSMG_VLINE_CHAR] = '|';
+- SLcurses_Acs_Map[SLSMG_HLINE_CHAR] = '-';
+- SLcurses_Acs_Map[SLSMG_PLUS_CHAR] = '+';
+- SLcurses_Acs_Map[SLSMG_CKBRD_CHAR] = '#';
++ SLcurses_Acs_Map['l'] = '+';
++ SLcurses_Acs_Map['k'] = '+';
++ SLcurses_Acs_Map['m'] = '+';
++ SLcurses_Acs_Map['j'] = '+';
++ SLcurses_Acs_Map['v'] = '+';
++ SLcurses_Acs_Map['w'] = '+';
++ SLcurses_Acs_Map['t'] = '+';
++ SLcurses_Acs_Map['u'] = '+';
++ SLcurses_Acs_Map['x'] = '|';
++ SLcurses_Acs_Map['q'] = '-';
++ SLcurses_Acs_Map['n'] = '+';
++ SLcurses_Acs_Map['a'] = '#';
+ }
+-
+- return SLcurses_Stdscr;
+ }
+
+ int SLcurses_wattrset (SLcurses_Window_Type *w, SLtt_Char_Type ch)
+--- slang-1.4.5/src/slcurses.h.acs 2002-02-10 02:39:19.000000000 -0500
++++ slang-1.4.5/src/slcurses.h 2002-07-09 00:03:57.000000000 -0400
+@@ -141,6 +141,7 @@
+
+ extern int SLcurses_nodelay (SLcurses_Window_Type *, int);
+ extern SLcurses_Window_Type *SLcurses_initscr (void);
++extern void SLcurses_init_acs_map (void);
+ #define initscr SLcurses_initscr
+
+ extern int SLcurses_cbreak (void);
+@@ -222,21 +222,21 @@
+ extern SLtt_Char_Type SLcurses_Acs_Map [128];
+ #define acs_map SLcurses_Acs_Map
+
+-#define ACS_ULCORNER (acs_map[SLSMG_ULCORN_CHAR])
+-#define ACS_URCORNER (acs_map[SLSMG_URCORN_CHAR])
+-#define ACS_LRCORNER (acs_map[SLSMG_LRCORN_CHAR])
+-#define ACS_LLCORNER (acs_map[SLSMG_LLCORN_CHAR])
+-#define ACS_TTEE (acs_map[SLSMG_UTEE_CHAR])
+-#define ACS_LTEE (acs_map[SLSMG_LTEE_CHAR])
+-#define ACS_RTEE (acs_map[SLSMG_RTEE_CHAR])
+-#define ACS_BTEE (acs_map[SLSMG_DTEE_CHAR])
+-#define ACS_PLUS (acs_map[SLSMG_PLUS_CHAR])
+-#define ACS_VLINE (acs_map[SLSMG_VLINE_CHAR])
+-#define ACS_HLINE (acs_map[SLSMG_HLINE_CHAR])
++#define ACS_ULCORNER SLSMG_ULCORN_CHAR
++#define ACS_URCORNER SLSMG_URCORN_CHAR
++#define ACS_LRCORNER SLSMG_LRCORN_CHAR
++#define ACS_LLCORNER SLSMG_LLCORN_CHAR
++#define ACS_TTEE SLSMG_UTEE_CHAR
++#define ACS_LTEE SLSMG_LTEE_CHAR
++#define ACS_RTEE SLSMG_RTEE_CHAR
++#define ACS_BTEE SLSMG_DTEE_CHAR
++#define ACS_PLUS SLSMG_PLUS_CHAR
++#define ACS_VLINE SLSMG_VLINE_CHAR
++#define ACS_HLINE SLSMG_HLINE_CHAR
+ #define ACS_S1 '-'
+ #define ACS_S9 '-'
+ #define ACS_DIAMOND '&'
+-#define ACS_CKBOARD (acs_map[SLSMG_CKBRD_CHAR])
++#define ACS_CKBOARD SLSMG_CKBRD_CHAR
+ #define ACS_DEGREE 'o'
+ #define ACS_PLMINUS '+'
+ #define ACS_BULLET '*'
+--- slang-1.4.5/src/slsmg.c.acs 2002-07-09 00:03:57.000000000 -0400
++++ slang-1.4.5/src/slsmg.c 2002-07-09 00:03:57.000000000 -0400
+@@ -10,6 +10,9 @@
+
+ #include "slang.h"
+ #include "_slang.h"
++#include "slcurses.h"
++
++#include <locale.h>
+
+ typedef struct Screen_Type
+ {
+@@ -44,9 +47,9 @@
+ */
+
+ #ifndef IBMPC_SYSTEM
+-#define ALT_CHAR_FLAG 0x80
++static int ALT_CHAR_FLAG=0x80;
+ #else
+-#define ALT_CHAR_FLAG 0x00
++static int ALT_CHAR_FLAG=0x00;
+ #endif
+
+ #if SLTT_HAS_NON_BCE_SUPPORT && !defined(IBMPC_SYSTEM)
+@@ -54,6 +57,8 @@
+ static int Bce_Color_Offset;
+ #endif
+
++int SLsmg_Is_Unicode = 0;
++int SLsmg_Setlocale = 1;
+ int SLsmg_Newline_Behavior = 0;
+ int SLsmg_Backspace_Moves = 0;
+ /* Backward compatibility. Not used. */
+@@ -184,6 +189,8 @@
+ return;/* alt chars not used and the alt bit
+ * is used to indicate a blink.
+ */
++ if (SLsmg_Is_Unicode)
++ ALT_CHAR_FLAG=0x00;
+
+ if (i) This_Alt_Char = ALT_CHAR_FLAG;
+ else This_Alt_Char = 0;
+@@ -348,6 +355,8 @@
+ #ifndef IBMPC_SYSTEM
+ int alt_char_set_flag;
+
++ if (SLsmg_Is_Unicode)
++ ALT_CHAR_FLAG = 0x00;
+ alt_char_set_flag = ((This_Color & ALT_CHAR_FLAG)
+ && ((tt_Use_Blink_For_ACS == NULL)
+ || (*tt_Use_Blink_For_ACS == 0)));
+@@ -1221,6 +1230,20 @@
+ Smg_Inited = 0;
+ }
+
++static void SLsmg_check_unicode(void)
++{
++ char *s,*t;
++
++ if (SLsmg_Setlocale)
++ s = setlocale(LC_ALL, "");
++ else
++ s = setlocale(LC_ALL, NULL);
++ if (s && (strstr(s,"UTF-8") || strstr(s,"utf8"))) {
++ SLsmg_Is_Unicode = 1;
++ return;
++ }
++ SLsmg_Is_Unicode = 0;
++}
+
+ static int init_smg (void)
+ {
+@@ -1242,6 +1265,8 @@
+ This_Col = This_Row = Start_Col = Start_Row = 0;
+
+ This_Alt_Char = 0;
++ SLsmg_check_unicode ();
++ SLcurses_init_acs_map ();
+ SLsmg_set_color (0);
+ Cls_Flag = 1;
+ #ifndef IBMPC_SYSTEM
+@@ -1386,7 +1411,11 @@
+ }
+ }
+
++#ifdef UTF8
++void SLsmg_draw_object (int r, int c, SLsmg_Char_Type object)
++#else
+ void SLsmg_draw_object (int r, int c, unsigned char object)
++#endif
+ {
+ This_Row = r; This_Col = c;
+
+@@ -1405,7 +1434,7 @@
+
+ void SLsmg_draw_hline (unsigned int n)
+ {
+- static unsigned char hbuf[16];
++ SLsmg_Char_Type ch = SLSMG_HLINE_CHAR;
+ int count;
+ int cmin, cmax;
+ int final_col = This_Col + (int) n;
+@@ -1421,11 +1450,6 @@
+ return;
+ }
+
+- if (hbuf[0] == 0)
+- {
+- SLMEMSET ((char *) hbuf, SLSMG_HLINE_CHAR, 16);
+- }
+-
+ n = (unsigned int)(cmax - cmin);
+ count = n / 16;
+
+@@ -1433,10 +1457,10 @@
+ This_Color |= ALT_CHAR_FLAG;
+ This_Col = cmin;
+
+- SLsmg_write_nchars ((char *) hbuf, n % 16);
+- while (count-- > 0)
++ SLsmg_draw_object(This_Row, This_Col, ch);
++ while (n-- > 0)
+ {
+- SLsmg_write_nchars ((char *) hbuf, 16);
++ SLsmg_draw_object(This_Row, This_Col, ch);
+ }
+
+ This_Color = save_color;
+@@ -1445,7 +1469,7 @@
+
+ void SLsmg_draw_vline (int n)
+ {
+- unsigned char ch = SLSMG_VLINE_CHAR;
++ SLsmg_Char_Type ch = SLSMG_VLINE_CHAR;
+ int c = This_Col, rmin, rmax;
+ int final_row = This_Row + n;
+ int save_color;
+@@ -1466,7 +1490,7 @@
+ for (This_Row = rmin; This_Row < rmax; This_Row++)
+ {
+ This_Col = c;
+- SLsmg_write_nchars ((char *) &ch, 1);
++ SLsmg_draw_object (This_Row, This_Col, ch);
+ }
+
+ This_Col = c; This_Row = final_row;
diff --git a/sys-libs/slang/files/slang-utf8-fix.patch b/sys-libs/slang/files/slang-utf8-fix.patch
new file mode 100644
index 000000000000..6c0a80f1ea1e
--- /dev/null
+++ b/sys-libs/slang/files/slang-utf8-fix.patch
@@ -0,0 +1,34 @@
+--- slang-1.4.5/src/slsmg.c.jj 2003-02-21 12:11:37.000000000 -0500
++++ slang-1.4.5/src/slsmg.c 2003-02-21 14:09:28.000000000 -0500
+@@ -378,8 +378,10 @@ void SLsmg_write_nwchars (wchar_t *str,
+ for (i = 0; i < n; i++, str) {
+ ch = *str++;
+ #ifndef IBMPC_SYSTEM
+- if (alt_char_set_flag)
++ if (alt_char_set_flag) {
+ ch = Alt_Char_Set[ch & 0x7F];
++ w = 1;
++ } else
+ #endif
+ w = wcwidth(ch);
+
+--- slang-1.4.5/src/sldisply.c.jj 2003-02-21 12:11:37.000000000 -0500
++++ slang-1.4.5/src/sldisply.c 2003-02-21 15:51:43.000000000 -0500
+@@ -1498,6 +1498,17 @@ static void write_wstring_with_care (SLs
+ }
+ }
+
++ if (Current_Fgbg & SLTT_ALTC_MASK)
++ {
++ char c;
++ while (len--)
++ {
++ c = *str++;
++ tt_write(&c, 1);
++ }
++ return;
++ }
++
+ memset (&mbstate, 0, sizeof (mbstate));
+ while (len--)
+ {
diff --git a/sys-libs/slang/metadata.xml b/sys-libs/slang/metadata.xml
index 118c083af80d..5121fe356756 100644
--- a/sys-libs/slang/metadata.xml
+++ b/sys-libs/slang/metadata.xml
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
-<herd>no-herd</herd>
-<maintainer><email>liquidx@gentoo.org</email></maintainer>
-<maintainer><email>yakina@gentoo.org</email></maintainer>
+<herd>cjk</herd>
+<maintainer>
+ <email>liquidx@gentoo.org</email>
+</maintainer>
+<maintainer>
+ <email>yakina@gentoo.org</email>
+</maintainer>
</pkgmetadata>
diff --git a/sys-libs/slang/slang-1.4.5-r1.ebuild b/sys-libs/slang/slang-1.4.5-r1.ebuild
index dd43809fff6d..66a5461d7eac 100644
--- a/sys-libs/slang/slang-1.4.5-r1.ebuild
+++ b/sys-libs/slang/slang-1.4.5-r1.ebuild
@@ -1,6 +1,6 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-libs/slang/slang-1.4.5-r1.ebuild,v 1.14 2003/06/22 05:10:31 seemant Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/slang/slang-1.4.5-r1.ebuild,v 1.15 2004/06/06 16:52:12 usata Exp $
S=${WORKDIR}/${P}
DESCRIPTION="Console display library used by most text viewer"
diff --git a/sys-libs/slang/slang-1.4.5-r2.ebuild b/sys-libs/slang/slang-1.4.5-r2.ebuild
index 23655299a5eb..08af54d9b60c 100644
--- a/sys-libs/slang/slang-1.4.5-r2.ebuild
+++ b/sys-libs/slang/slang-1.4.5-r2.ebuild
@@ -1,6 +1,6 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-libs/slang/slang-1.4.5-r2.ebuild,v 1.23 2004/02/22 23:09:25 agriffis Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/slang/slang-1.4.5-r2.ebuild,v 1.24 2004/06/06 16:52:12 usata Exp $
S=${WORKDIR}/${P}
DESCRIPTION="Console display library used by most text viewer"
diff --git a/sys-libs/slang/slang-1.4.9-r1.ebuild b/sys-libs/slang/slang-1.4.9-r1.ebuild
new file mode 100644
index 000000000000..8d2a2a38b827
--- /dev/null
+++ b/sys-libs/slang/slang-1.4.9-r1.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2004 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/slang/slang-1.4.9-r1.ebuild,v 1.1 2004/06/06 16:52:12 usata Exp $
+
+inherit gcc eutils
+
+DESCRIPTION="Console display library used by most text viewer"
+HOMEPAGE="http://space.mit.edu/~davis/slang/"
+# Patches are taken from http://www.suse.de/~nadvornik/slang/
+# They were originally Red Hat and Debian's patches
+SRC_URI="ftp://space.mit.edu/pub/davis/slang/v1.4/${P}.tar.bz2"
+
+LICENSE="GPL-2 | Artistic"
+SLOT="0"
+KEYWORDS="~x86 ~ppc ~sparc ~alpha ~mips ~hppa ~amd64 ~ia64 ~ppc64 ~s390"
+IUSE="cjk unicode"
+
+DEPEND=">=sys-libs/ncurses-5.2-r2"
+
+src_unpack() {
+ unpack ${P}.tar.bz2
+ cd ${S}
+
+ epatch ${FILESDIR}/${P}.dif
+ epatch ${FILESDIR}/${P}-fsuid.dif
+ epatch ${FILESDIR}/${P}-autoconf.dif
+ if use unicode ; then
+ epatch ${FILESDIR}/slang-debian-utf8.patch
+ epatch ${FILESDIR}/slang-utf8-acs.patch
+ epatch ${FILESDIR}/slang-utf8-fix.patch
+ fi
+ if use cjk ; then
+ # enable Kanji Support
+ cp src/sl-feat.h src/sl-feat.h.bak
+ sed "/SLANG_HAS_KANJI_SUPPORT/s/0/1/" \
+ src/sl-feat.h.bak > src/sl-feat.h
+ fi
+}
+
+src_compile() {
+ econf || die "econf failed"
+ # emake doesn't work well with slang, so just use normal make.
+ make all elf || die "make failed"
+}
+
+src_install() {
+ make install install-elf DESTDIR=${D} || die "make install failed"
+ fperms 755 /usr/lib/libslang.so.*
+
+ if use unicode ; then
+ for i in ${D}/usr/lib/libslang-utf8* ; do
+ local libslang=${i/${D}/}
+ dosym ${libslang} ${libslang/-utf8/}
+ done
+ dosym /usr/lib/libslang{-utf8,}.a
+ fi
+
+ # remove the documentation... we want to install it ourselves
+ rm -rf ${D}/usr/doc
+ dodoc COPYING* NEWS README *.txt
+ dodoc doc/*.txt doc/internal/*.txt doc/text/*.txt
+ dohtml doc/*.html
+}