LANG=en_US.UTF-8
export TERM LANG
-#/bin/unicode_start lat0-16
+/bin/unicode_start lat0-16
+#usr/bin/whiptail
#usr/include/newt.h
-usr/lib/libnewt-utf8.so.0.50.17
+#usr/lib/libnewt.a
usr/lib/libnewt.so
-usr/lib/libnewt.so.0.50
+usr/lib/libnewt.so.0.51.6
#usr/lib/python2.4/site-packages/_snackmodule.so
#usr/lib/python2.4/site-packages/snack.py
-#etc/slsh.rc
-#usr/bin/slsh
+#usr/doc
+#usr/doc/slang
+#usr/doc/slang/COPYING
+#usr/doc/slang/COPYING.ART
+#usr/doc/slang/COPYING.GPL
+#usr/doc/slang/COPYRIGHT
+#usr/doc/slang/changes.txt
+#usr/doc/slang/cref.txt
+#usr/doc/slang/cslang.txt
+#usr/doc/slang/slang.txt
+#usr/doc/slang/slangdoc.html
+#usr/doc/slang/slangfun.txt
#usr/include/slang.h
#usr/include/slcurses.h
+#usr/lib/libslang-utf8.a
+usr/lib/libslang-utf8.so
+usr/lib/libslang-utf8.so.1
+usr/lib/libslang-utf8.so.1.4.9
#usr/lib/libslang.a
usr/lib/libslang.so
-usr/lib/libslang.so.2
-usr/lib/libslang.so.2.0.6
-#usr/lib/slang
-#usr/lib/slang/v2
-#usr/lib/slang/v2/modules
-#usr/lib/slang/v2/modules/fcntl-module.so
-#usr/lib/slang/v2/modules/pcre-module.so
-#usr/lib/slang/v2/modules/png-module.so
-#usr/lib/slang/v2/modules/select-module.so
-#usr/lib/slang/v2/modules/slsmg-module.so
-#usr/lib/slang/v2/modules/termios-module.so
-#usr/lib/slang/v2/modules/varray-module.so
-#usr/man/man1/slsh.1
-#usr/share/doc/slang
-#usr/share/doc/slang/v2
-#usr/share/doc/slang/v2/COPYING
-#usr/share/doc/slang/v2/changes.txt
-#usr/share/doc/slang/v2/cref.txt
-#usr/share/doc/slang/v2/cslang.txt
-#usr/share/doc/slang/v2/slang.txt
-#usr/share/doc/slang/v2/slangdoc.html
-#usr/share/doc/slang/v2/slangfun.txt
-#usr/share/slsh
-#usr/share/slsh/arrayfuns.sl
-#usr/share/slsh/autoload.sl
-#usr/share/slsh/cmaps
-#usr/share/slsh/cmaps/cool.map
-#usr/share/slsh/cmaps/copper.map
-#usr/share/slsh/cmaps/drywet.map
-#usr/share/slsh/cmaps/gebco.map
-#usr/share/slsh/cmaps/globe.map
-#usr/share/slsh/cmaps/gray.map
-#usr/share/slsh/cmaps/haxby.map
-#usr/share/slsh/cmaps/hot.map
-#usr/share/slsh/cmaps/jet.map
-#usr/share/slsh/cmaps/no_green.map
-#usr/share/slsh/cmaps/ocean.map
-#usr/share/slsh/cmaps/polar.map
-#usr/share/slsh/cmaps/rainbow.map
-#usr/share/slsh/cmaps/red2green.map
-#usr/share/slsh/cmaps/relief.map
-#usr/share/slsh/cmaps/sealand.map
-#usr/share/slsh/cmaps/seis.map
-#usr/share/slsh/cmaps/split.map
-#usr/share/slsh/cmaps/topo.map
-#usr/share/slsh/cmaps/wysiwyg.map
-#usr/share/slsh/fcntl.sl
-#usr/share/slsh/glob.sl
-#usr/share/slsh/help
-#usr/share/slsh/help/pcrefuns.hlp
-#usr/share/slsh/help/pngfuns.hlp
-#usr/share/slsh/local-packages
-#usr/share/slsh/pcre.sl
-#usr/share/slsh/png.sl
-#usr/share/slsh/print.sl
-#usr/share/slsh/profile.sl
-#usr/share/slsh/require.sl
-#usr/share/slsh/scripts
-#usr/share/slsh/scripts/jpegsize
-#usr/share/slsh/scripts/lsrpm
-#usr/share/slsh/scripts/sldb
-#usr/share/slsh/scripts/slprof
-#usr/share/slsh/scripts/svnsh
-#usr/share/slsh/select.sl
-#usr/share/slsh/sldb.sl
-#usr/share/slsh/sldbcore.sl
-#usr/share/slsh/slshrl.sl
-#usr/share/slsh/slsmg.sl
-#usr/share/slsh/stkcheck.sl
-#usr/share/slsh/structfuns.sl
-#usr/share/slsh/termios.sl
-#usr/share/slsh/varray.sl
#usr/bin/clamav-config
-usr/bin/clamconf
+#usr/bin/clamconf
usr/bin/clamdscan
usr/bin/clamscan
usr/bin/freshclam
#usr/lib/libclamav.a
#usr/lib/libclamav.la
usr/lib/libclamav.so
-usr/lib/libclamav.so.1
-usr/lib/libclamav.so.1.0.40
+usr/lib/libclamav.so.2
+usr/lib/libclamav.so.2.0.2
#usr/lib/pkgconfig/libclamav.pc
usr/sbin/clamd
#usr/share/clamav
* ccache-2.4
* cdrtools-2.01
* cftp-0.12
-* clamav-0.90
+* clamav-0.90.2
* coreutils-5.96
* cpio-2.6
* cups-1.2.2
* ncftp-3.1.9-src
* ncurses-5.5
* net-tools-1.60
-* newt-utf8_0.50.17
+* newt-0.51.6
* nfs-utils-1.0.8
* nmap-4.03
* noip_updater_v1.6
* sed-4.1.5
* setserial-2.17
* shadow-4.0.15
-* slang-2.0.6
+* slang-1.4.9
* smartmontools-5.36
* snort-2.6.1.4
* sox-12.18.1
cd / && tar --create --directory=/ --files-from=/install/packages/package/ROOTFILES \
--file=/packagetmp.tar --exclude='#*'
cd / && tar -x -C /tmp -f /packagetmp.tar
- @rm -f /packagetmp.tar
+ rm -f /packagetmp.tar
-cd /tmp && tar cjvf /install/packages/package/files.tbz2 *
- @cd / && rm -rf /tmp/*
- @cd /install/packages/package && cat ROOTFILES | grep -v "#" > ROOTFILES
+ cd / && rm -rf /tmp/*
+ cd /install/packages/package && cat ROOTFILES | grep -v "#" > ROOTFILES
cd /install/packages/package && tar cfj ../$(PROG)-$(VER)-$(PAK_VER).ipfire \
files.tbz2 install.sh uninstall.sh update.sh ROOTFILES
- @rm -rf /install/packages/package
+ rm -rf /install/packages/package
sed -e s/NAME/$(PROG)/g \
-e s/VER/$(VER)/g \
-e s/RELEASE/$(PAK_VER)/g \
include Config
-VER = 0.50.17
+VER = 0.51.6
-THISAPP = newt-utf8_$(VER)
-DL_FILE = $(THISAPP).orig.tar.gz
+THISAPP = newt-$(VER)
+DL_FILE = $(THISAPP).tar.gz
DL_FROM = $(URL_IPFIRE)
-DIR_APP = $(DIR_SRC)/newt-0.50.17
+DIR_APP = $(DIR_SRC)/$(THISAPP)
ifeq "$(LFS_PASS)" "install"
TARGET = $(DIR_INFO)/$(THISAPP)-install
else
# Top-level Rules
###############################################################################
-objects = $(DL_FILE) $(THISAPP)-9.6.diff.gz
+objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(THISAPP)-9.6.diff.gz = $(DL_FROM)/$(THISAPP)-9.6.diff.gz
-$(DL_FILE)_MD5 = 4079546c307475ef2508dd2e98ed505e
-$(THISAPP)-9.6.diff.gz_MD5 = 5f1522189bdb16622677ad8e52f93119
+$(DL_FILE)_MD5 = 98567d5a18535e3a926dca5b4527b4a9
install : $(TARGET)
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
- cd $(DIR_APP) && zcat $(DIR_DL)/$(THISAPP)-9.6.diff.gz | patch -Np1
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/newt-0.50.17-colors.patch
- cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/newt-0.50.17-vaend.patch
+ cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/newt-0.51.6-if1close.patch
ifeq "$(LFS_PASS)" "install"
cd $(DIR_APP) && ./configure --without-gpm-support --host $(MACHINE)-uclibc
cd $(DIR_APP) && sed -i 's%^CFLAGS.*$$%CFLAGS = -Os -fomit-frame-pointer -Wall -D_GNU_SOURCE -DUTF8 -I/opt/i586-uClibc/include%' Makefile
cd $(DIR_APP) && install -m 0644 libnewt.a /opt/$(MACHINE)-uClibc/lib/libnewt.a
cd $(DIR_APP) && install -m 0644 newt.h /opt/$(MACHINE)-uClibc/include/newt.h
else
- cd $(DIR_APP) && RPM_OPT_FLAGS="$(CFLAGS) -DUTF8" ./configure --without-gpm-support
- cd $(DIR_APP) && sed -i \
- -e 's/^PYVER.*$$/PYVER = 2.4/' \
- -e 's/^all:.*$$/all: _snackmodule.so/' Makefile
- cd $(DIR_APP) && echo 'install-snack: _snackmodule.so' >> Makefile
- cd $(DIR_APP) && echo ' install -s -m 644 _snackmodule.so $$(instroot)/$$(pythonbindir)' >> Makefile
- cd $(DIR_APP) && echo ' install -m 644 snack.py $$(instroot)/$$(pythonbindir)' >> Makefile
- cd $(DIR_APP) && RPM_OPT_FLAGS="$(CFLAGS)" make install-snack
- cd $(DIR_APP) && RPM_OPT_FLAGS="$(CFLAGS)" make install-utf8sh
+ cd $(DIR_APP) && ./configure --without-gpm-support
+ cd $(DIR_APP) && sed -i 's%^CFLAGS.*$$%CFLAGS = $(CFLAGS) -Wall -D_GNU_SOURCE%' Makefile
+ cd $(DIR_APP) && make
+ cd $(DIR_APP) && make install
cd $(DIR_APP) && install -m 0644 newt.h /usr/include
- ln -sf libnewt.so.0.50 /usr/lib/libnewt.so
+ ln -sf libnewt.so.0.51 /usr/lib/libnewt.so
endif
@rm -rf $(DIR_APP)
@$(POSTBUILD)
include Config
-VER = 2.0.6
+VER = 1.4.9
THISAPP = slang-$(VER)
DL_FILE = $(THISAPP).tar.bz2
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = efb055000636f312d5c3de56f3c70d12
+$(DL_FILE)_MD5 = 4fbb1a7f1257e065ca830deefe13d350
install : $(TARGET)
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
+ cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/slang-debian-utf8.patch
+ cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/slang-utf8-acs.patch
+ cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/slang-1.4.5-utf8-segv.patch
+ cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/slang-utf8-fix.patch
ifeq "$(LFS_PASS)" "install"
+ cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/slang-1.4.9-uclibc.patch
cd $(DIR_APP) && ./configure --prefix=""
- cd $(DIR_APP)/src && patch < $(DIR_SRC)/src/patches/slang-$(VER)-uclibc.patch
cd $(DIR_APP)/src && make
cd $(DIR_APP)/src && make install DESTDIR="/opt/$(MACHINE)-uClibc"
+ ln -sf libslang-utf8.a /opt/$(MACHINE)-uClibc/lib/libslang.a
else
- cd $(DIR_APP) && ./configure --prefix=/usr --sysconfdir=/etc
- cd $(DIR_APP) && make $(MAKETUNING)
- cd $(DIR_APP) && make elf
+ perl -p -i -e 's/(ELF_CFLAGS=\"[^\"]*)-O2([^\"]*\".*)/$1'"$(CFLAGS)"' $2/gs' configure
+ cd $(DIR_APP) && ./configure --prefix=/usr
+ cd $(DIR_APP) && make elf all
cd $(DIR_APP) && make install-elf
- cd $(DIR_APP) && chmod -v 755 /usr/lib/libslang.so.2.0.6
+ ln -sf libslang-utf8.so.1.4.9 /usr/lib/libslang-utf8.so.1
+ ln -sf libslang-utf8.so /usr/lib/libslang.so
+ ln -sf libslang-utf8.a /usr/lib/libslang.a
endif
@rm -rf $(DIR_APP)
@$(POSTBUILD)
--- /dev/null
+--- newt-0.51.6/form.c.orig 2004-10-15 11:17:35.042333181 -0400
++++ newt-0.51.6/form.c 2004-10-15 11:18:53.428533351 -0400
+@@ -889,6 +889,7 @@
+ struct eventResult er;
+ int key, i, max;
+ int done = 0;
++ int success;
+ fd_set readSet, writeSet, exceptSet;
+ struct timeval nextTimeout, now, timeout;
+ #ifdef USE_GPM
+@@ -902,7 +903,7 @@
+ conn.minMod = 0;
+ conn.maxMod = 0;
+
+- Gpm_Open(&conn, 0);
++ success = Gpm_Open(&conn, 0);
+ #endif
+
+ newtFormSetSize(co);
+@@ -1062,7 +1063,8 @@
+ }
+ newtRefresh();
+ #ifdef USE_GPM
+- Gpm_Close();
++ if (success > 0)
++ Gpm_Close();
+ #endif
+ }
+
--- /dev/null
+diff -ru slang-1.4.5/src/slsmg.c slang-1.4.5-new/src/slsmg.c
+--- slang-1.4.5/src/slsmg.c 2002-07-25 00:09:00.000000000 -0400
++++ slang-1.4.5-new/src/slsmg.c 2002-07-25 00:04:02.000000000 -0400
+@@ -369,7 +369,10 @@
+
+ max_len = Start_Col + Screen_Cols;
+ len = This_Col;
+- p = SL_Screen[This_Row - Start_Row].neew + len - Start_Col;
++
++
++ p = SL_Screen[This_Row - Start_Row].neew;
++ if (len > Start_Col) p += len - Start_Col;
+ prev = 0;
+
+ for (i = 0; i < n; i++, str) {
--- /dev/null
+diff -ru slang-1.4.9.orig/src/slmisc.c slang-1.4.9/src/slmisc.c
+--- slang-1.4.9.orig/src/slmisc.c 2003-03-23 07:06:40.000000000 +0000
++++ slang-1.4.9/src/slmisc.c 2004-05-05 14:27:24.000000000 +0000
+@@ -565,7 +565,7 @@
+ return (int) SLatol (s);
+ }
+
+-#if !defined(HAVE_ISSETUGID) && defined(__GLIBC__) && (__GLIBC__ >= 2)
++#if 0
+ extern int __libc_enable_secure;
+ # define HAVE___LIBC_ENABLE_SECURE 1
+ #endif
+++ /dev/null
---- slcommon.c.tmp 2006-11-07 22:53:31.000000000 +0000
-+++ slcommon.c 2006-11-07 17:56:04.000000000 +0000
-@@ -191,7 +191,7 @@
- return p;
- }
-
--#if !defined(HAVE_ISSETUGID) && defined(__GLIBC__) && (__GLIBC__ >= 2)
-+#if 0
- extern int __libc_enable_secure;
- # define HAVE___LIBC_ENABLE_SECURE 1
- #endif
--- /dev/null
+--- 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 ();
+ }
+
--- /dev/null
+--- 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;
--- /dev/null
+--- 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--)
+ {