From 28c850952b0cbcbc58ecf7481ccbd6da27130c7a Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 6 Jan 2024 05:47:30 +0100 Subject: [PATCH] rebuilt with --enable-wide-chars build with libonig [release 2.2.4-2mamba;Thu Jul 26 2012] --- README.md | 6 + libslang-1.4.9-autoconf.patch | 149 +++++ libslang-1.4.9-debian-utf8.patch | 917 +++++++++++++++++++++++++++++ libslang-1.4.9-fsuid.patch | 33 ++ libslang-1.4.9-gcc4.patch | 34 ++ libslang-1.4.9-suse.patch | 73 +++ libslang-1.4.9-utf8-acs.patch | 417 +++++++++++++ libslang-1.4.9-utf8-fix.patch | 34 ++ libslang-2.0.5-SLutf8_enable.patch | 14 + libslang-2.0.5-makefile.patch | 44 ++ libslang-2.0.5-nointerlibc2.patch | 38 ++ libslang-README.UTF-8 | 12 + libslang.spec | 231 ++++++++ 13 files changed, 2002 insertions(+) create mode 100644 libslang-1.4.9-autoconf.patch create mode 100644 libslang-1.4.9-debian-utf8.patch create mode 100644 libslang-1.4.9-fsuid.patch create mode 100644 libslang-1.4.9-gcc4.patch create mode 100644 libslang-1.4.9-suse.patch create mode 100644 libslang-1.4.9-utf8-acs.patch create mode 100644 libslang-1.4.9-utf8-fix.patch create mode 100644 libslang-2.0.5-SLutf8_enable.patch create mode 100644 libslang-2.0.5-makefile.patch create mode 100644 libslang-2.0.5-nointerlibc2.patch create mode 100644 libslang-README.UTF-8 create mode 100644 libslang.spec diff --git a/README.md b/README.md index 15a4b84..10d0e92 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,8 @@ # libslang +S-Lang is an interpreted language and a programming library. +The S-Lang language was designed so that it can be easily embedded into a program to provide the program with a powerful extension language. +The S-Lang library, provided in this package, provides the S-Lang extension language. +S-Lang's syntax resembles C, which makes it easy to recode S-Lang procedures in C if you need to. + + diff --git a/libslang-1.4.9-autoconf.patch b/libslang-1.4.9-autoconf.patch new file mode 100644 index 0000000..f5a6130 --- /dev/null +++ b/libslang-1.4.9-autoconf.patch @@ -0,0 +1,149 @@ +--- slang-1.4.9/autoconf/configure.in.old 2002-09-13 13:53:56.000000000 +0200 ++++ slang-1.4.9/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 +--- slang-1.4.9/utoconf/aclocal.m4.old 2002-09-13 13:35:17.000000000 +0200 ++++ slang-1.4.9/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/libslang-1.4.9-debian-utf8.patch b/libslang-1.4.9-debian-utf8.patch new file mode 100644 index 0000000..62eb670 --- /dev/null +++ b/libslang-1.4.9-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 + #endif + ++#define UTF8 1 ++ ++#ifdef UTF8 ++#include ++#include ++#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 + #include ++#include + + #if !defined(VMS) || (__VMS_VER >= 70000000) + # include +@@ -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/libslang-1.4.9-fsuid.patch b/libslang-1.4.9-fsuid.patch new file mode 100644 index 0000000..9515ceb --- /dev/null +++ b/libslang-1.4.9-fsuid.patch @@ -0,0 +1,33 @@ +diff -ru slang-1.4.9/autoconf/configure.in slang-1.4.9-utf8/autoconf/configure.in +--- slang-1.4.9/autoconf/configure.in 2003-03-23 08:06:40.000000000 +0100 ++++ slang-1.4.9-utf8/autoconf/configure.in 2006-01-31 16:12:11.000000000 +0100 +@@ -38,8 +38,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 +diff -ru slang-1.4.9/src/slinclud.h slang-1.4.9-utf8/src/slinclud.h +--- slang-1.4.9/src/slinclud.h 2003-03-23 08:06:40.000000000 +0100 ++++ slang-1.4.9-utf8/src/slinclud.h 2006-01-31 16:13:50.000000000 +0100 +@@ -27,4 +27,8 @@ + # include + #endif + ++#ifdef HAVE_SYS_FSUID_H ++# include ++#endif ++ + #endif /* _SLANG_INCLUDE_H_ */ diff --git a/libslang-1.4.9-gcc4.patch b/libslang-1.4.9-gcc4.patch new file mode 100644 index 0000000..1280afb --- /dev/null +++ b/libslang-1.4.9-gcc4.patch @@ -0,0 +1,34 @@ +Patch by Robert Scheck for slang >= 1.4.9, which +makes slang rebuildable using gcc 4. + +--- slang-1.4.9/src/sltoken.c 2003-03-23 08:06:40.000000000 +0100 ++++ slang-1.4.9/src/sltoken.c.gcc4 2005-03-14 09:01:16.000000000 +0100 +@@ -789,7 +789,7 @@ + #if _SLANG_HAS_DEBUG_CODE + tok->line_number++; + #endif +- Input_Line = LLT->read(LLT); ++ Input_Line = (LLT->read) (LLT); + if ((NULL == Input_Line) || SLang_Error) + { + Input_Line_Pointer = Input_Line = NULL; +@@ -1185,7 +1185,7 @@ + { + case '\n': + case 0: +- if (NULL == (Input_Line = LLT->read(LLT))) ++ if (NULL == (Input_Line = (LLT->read) (LLT))) + { + Input_Line_Pointer = Input_Line = NULL; + return; +--- slang-1.4.9/src/slposio.c 2003-03-23 08:06:40.000000000 +0100 ++++ slang-1.4.9/src/slposio.c.gcc4 2005-03-14 09:03:00.000000000 +0100 +@@ -166,7 +166,7 @@ + || (NULL == (b = SLmalloc (len + 1)))) + goto return_error; + +- if (-1 == f->read (f->fd, b, &len)) ++ if (-1 == (f->read) (f->fd, b, &len)) + { + _SLerrno_errno = errno; + goto return_error; diff --git a/libslang-1.4.9-suse.patch b/libslang-1.4.9-suse.patch new file mode 100644 index 0000000..f59bdbb --- /dev/null +++ b/libslang-1.4.9-suse.patch @@ -0,0 +1,73 @@ +diff -pur slang-1.4.9/src/sldisply.c slang-1.4.9-utf8/src/sldisply.c +--- slang-1.4.9/src/sldisply.c 2003-03-23 08:06:40.000000000 +0100 ++++ slang-1.4.9-utf8/src/sldisply.c 2006-01-31 16:03:07.000000000 +0100 +@@ -2248,6 +2248,13 @@ int SLtt_initialize (char *term) + 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. + */ +@@ -2256,6 +2263,7 @@ int SLtt_initialize (char *term) + 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')) +@@ -2452,10 +2460,12 @@ int SLtt_initialize (char *term) + /* 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 +diff -pur slang-1.4.9/src/sltermin.c slang-1.4.9-utf8/src/sltermin.c +--- slang-1.4.9/src/sltermin.c 2003-03-23 08:06:40.000000000 +0100 ++++ slang-1.4.9-utf8/src/sltermin.c 2006-01-31 16:04:28.000000000 +0100 +@@ -105,7 +105,31 @@ static FILE *open_terminfo (char *file, + * 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/libslang-1.4.9-utf8-acs.patch b/libslang-1.4.9-utf8-acs.patch new file mode 100644 index 0000000..dc8a851 --- /dev/null +++ b/libslang-1.4.9-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 + + 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/libslang-1.4.9-utf8-fix.patch b/libslang-1.4.9-utf8-fix.patch new file mode 100644 index 0000000..6c0a80f --- /dev/null +++ b/libslang-1.4.9-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/libslang-2.0.5-SLutf8_enable.patch b/libslang-2.0.5-SLutf8_enable.patch new file mode 100644 index 0000000..5a2bbb1 --- /dev/null +++ b/libslang-2.0.5-SLutf8_enable.patch @@ -0,0 +1,14 @@ +--- slang-2.0.5/src/slsmg.c.rasold 2005-12-02 12:54:03.000000000 +0100 ++++ slang-2.0.5/src/slsmg.c 2005-12-02 12:57:49.000000000 +0100 +@@ -1500,8 +1500,10 @@ + if (Smg_Inited) + SLsmg_reset_smg (); + +- if (UTF8_Mode == -1) ++ if (UTF8_Mode == -1){ ++ SLutf8_enable (-1); + UTF8_Mode = _pSLutf8_mode; ++ } + + if (-1 == (*tt_init_video) ()) + { diff --git a/libslang-2.0.5-makefile.patch b/libslang-2.0.5-makefile.patch new file mode 100644 index 0000000..f5e55b9 --- /dev/null +++ b/libslang-2.0.5-makefile.patch @@ -0,0 +1,44 @@ +--- slang-2.0.5/autoconf/Makefile.in.orig 2005-10-17 08:00:18.000000000 +0200 ++++ slang-2.0.5/autoconf/Makefile.in 2005-11-21 14:16:51.000000000 +0100 +@@ -8,12 +8,9 @@ + + all: + cd src; $(MAKE) all +- cd slsh; $(MAKE) all +- cd modules; $(MAKE) all ++ cd src; $(MAKE) elf + elf: + cd src; $(MAKE) elf +- cd slsh; $(MAKE) all +- cd modules; $(MAKE) all + @echo Use make install-elf to install it. + runtests: + cd src; $(MAKE) all +@@ -23,17 +20,12 @@ + clean: + /bin/rm -f *~ + cd src; $(MAKE) clean +- cd modules; $(MAKE) clean +- cd slsh; $(MAKE) clean + cd demo; $(MAKE) clean + install: + cd src; $(MAKE) install ++ cd src; $(MAKE) install-elf + install-elf: + cd src; $(MAKE) install-elf +- @echo Now installing slsh +- cd slsh; $(MAKE) install +- @echo Now installing the modules +- cd modules; $(MAKE) install + @echo "" + @echo "On some systems, e.g., linux, you may also have to run ldconfig." + @echo "" +@@ -44,8 +36,6 @@ + /bin/rm -f *~ Makefile config.status config.log config.cache files.pck + cd src; $(MAKE) distclean + cd demo; $(MAKE) distclean +- cd modules; $(MAKE) distclean +- cd slsh; $(MAKE) distclean + # + configure: autoconf/aclocal.m4 autoconf/configure.ac + cd autoconf && autoconf && mv ./configure .. diff --git a/libslang-2.0.5-nointerlibc2.patch b/libslang-2.0.5-nointerlibc2.patch new file mode 100644 index 0000000..030dfa0 --- /dev/null +++ b/libslang-2.0.5-nointerlibc2.patch @@ -0,0 +1,38 @@ +--- slang-2.0.5/src/slcommon.c.nointerlibc 2005-10-17 08:00:18.000000000 +0200 ++++ slang-2.0.5/src/slcommon.c 2005-11-21 14:26:28.000000000 +0100 +@@ -191,19 +191,19 @@ + return p; + } + +-#if !defined(HAVE_ISSETUGID) && defined(__GLIBC__) && (__GLIBC__ >= 2) +-extern int __libc_enable_secure; +-# define HAVE___LIBC_ENABLE_SECURE 1 +-#endif ++/* #if !defined(HAVE_ISSETUGID) && defined(__GLIBC__) && (__GLIBC__ >= 2) */ ++/* extern int __libc_enable_secure; */ ++/* # define HAVE___LIBC_ENABLE_SECURE 1 */ ++/* #endif */ + + int _pSLsecure_issetugid (void) + { + #ifdef HAVE_ISSETUGID + return (1 == issetugid ()); + #else +-# ifdef HAVE___LIBC_ENABLE_SECURE +- return __libc_enable_secure; +-# else ++/* # ifdef HAVE___LIBC_ENABLE_SECURE */ ++/* return __libc_enable_secure; */ ++/* # else */ + # if defined(HAVE_GETUID) && defined(HAVE_GETEUID) && defined(HAVE_GETGID) && defined(HAVE_GETEUID) + static int enable_secure; + if (enable_secure == 0) +@@ -218,7 +218,7 @@ + # else + return 0; + # endif +-# endif ++/* # endif */ + #endif + } + diff --git a/libslang-README.UTF-8 b/libslang-README.UTF-8 new file mode 100644 index 0000000..ad58520 --- /dev/null +++ b/libslang-README.UTF-8 @@ -0,0 +1,12 @@ +This version of slang includes patches for multibyte character support, +and line-drawing characters on unicode consoles. + +These patches change the API/ABI of slang slightly. + +Notable changes: + +- SLSMG_HLINE_CHAR (and friends) are no longer constants, so they + can not be used in static initializers. +- SLsmg_init_smg() now calls setlocale(). If you do not wish this + to happen, set SLsmg_Setlocale to 0. Note: doing so may hinder + the ability of your application to use line-drawing characters. diff --git a/libslang.spec b/libslang.spec new file mode 100644 index 0000000..0f7e3d1 --- /dev/null +++ b/libslang.spec @@ -0,0 +1,231 @@ +%define build_compat_lib 0 + +%define majversion %(echo %version | cut -d. -f 1-2) + +Name: libslang +Version: 2.2.4 +Release: 2mamba +Summary: The shared library for the S-Lang extension language +Group: System/Libraries +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: http://www.s-lang.org +Source0: ftp://ftp.fu-berlin.de/pub/unix/misc/slang/v%{majversion}/slang-%{version}.tar.bz2 +Source1: ftp://ftp.fu-berlin.de/pub/unix/misc/slang/v1.4/slang-1.4.9.tar.gz +Source2: %{name}-README.UTF-8 +Patch0: %{name}-1.4.9-gcc4.patch +Patch1: %{name}-1.4.9-suse.patch +Patch2: %{name}-1.4.9-autoconf.patch +Patch3: %{name}-1.4.9-fsuid.patch +Patch4: %{name}-1.4.9-debian-utf8.patch +Patch5: %{name}-1.4.9-utf8-acs.patch +Patch6: %{name}-1.4.9-utf8-fix.patch +Patch10: %{name}-2.0.5-makefile.patch +Patch11: %{name}-2.0.5-SLutf8_enable.patch +Patch12: %{name}-2.0.5-nointerlibc2.patch +License: GPL +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +## AUTOBUILDREQ-END +BuildRequires: libpcre-devel >= 6.3 +BuildRequires: libpng-devel >= 1.2.8 +BuildRequires: libonig-devel +BuildRoot: %{_tmppath}/%{name}-%{version}-root +Obsoletes: libslang1 + +%description +S-Lang is an interpreted language and a programming library. +The S-Lang language was designed so that it can be easily embedded into a program to provide the program with a powerful extension language. +The S-Lang library, provided in this package, provides the S-Lang extension language. +S-Lang's syntax resembles C, which makes it easy to recode S-Lang procedures in C if you need to. + + +%package -n slang +Summary: S-Lang is an interpreted language and a programming library. +Group: Applications/Development +Requires: %{name} = %{version}-%{release} + +%description -n slang +S-Lang is an interpreted language and a programming library. +The S-Lang language was designed so that it can be easily embedded into a program to provide the program with a powerful extension language. +The S-Lang library, provided in this package, provides the S-Lang extension language. +S-Lang's syntax resembles C, which makes it easy to recode S-Lang procedures in C if you need to. + +%if %{build_compat_lib} +%package -n %{name}1 +Summary: The shared library for the S-Lang extension language +Group: System/Libraries + +%description -n %{name}1 +S-Lang is an interpreted language and a programming library. +The S-Lang language was designed so that it can be easily embedded into a program to provide the program with a powerful extension language. +The S-Lang library, provided in this package, provides the S-Lang extension language. + +This package contains the the shared libraries libslang, version 1.4.9. +%endif + +%package devel +Summary: The static library and header files for development using S-Lang +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Obsoletes: libslang1-devel + +%description devel +This package contains the S-Lang extension language static libraries and header files which you'll need if you want to develop S-Lang based applications. +Documentation which may help you write S-Lang based applications is also included. + +Install the slang-devel package if you want to develop applications based on the S-Lang extension language. + +%prep +%setup -q -n slang-%{version} -a1 + +#%patch10 -p1 -b .makefile +#%patch11 -p1 -b .SLutf8_enable +#%patch12 -p1 -b .nointerlibc2 + +%if %{build_compat_lib} +cd slang-1.4.9 +%patch0 -p1 -b .gcc4 +#%patch1 -p1 -b .suse +#%patch2 -p1 -b .autoconf +#%patch3 -p1 -b .fsuid +#%patch4 -p1 -b .debian-utf8 +#%patch5 -p1 -b .utf8-acs +#%patch6 -p1 -b .utf8-fix +# +#cp -a %{S:2} ./README.UTF-8 +# +#mv autoconf/configure.in . +#mv autoconf/aclocal.m4 autoconf/acinclude.m4 +# +#autoheader -I autoconf +#aclocal -I autoconf --output=autoconf/aclocal.m4 +#autoconf -I autoconf +cd .. +%endif + +%build +perl -p -i -e \ +'s/(ELF_CFLAGS=\"[^\"]*)-O2([^\"]*\".*)/$1'"$RPM_OPT_FLAGS"' $2/gs' \ +configure + +%configure \ + --includedir=%{_includedir}/slang + +%make all + +%if %{build_compat_lib} +cd slang-1.4.9 +./configure --prefix=%{_prefix} --libdir=%{_libdir} + --enable-wide-chars +%make -j1 +%make -j1 elf +cd .. +%endif + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +install -d %{buildroot}%{_includedir}/slang + +%makeinstall \ + install_lib_dir=%{_libdir} \ + install_include_dir=%{_includedir}/slang + +#ln -sf libslang.so.%{version} %{buildroot}%{_libdir}/libslang.so.2 +#ln -sf libslang.so.%{version} %{buildroot}%{_libdir}/libslang-utf8.so +#ln -sf libslang.a %{buildroot}%{_libdir}/libslang-utf8.a + +%if %{build_compat_lib} +cp slang-1.4.9/src/elfobjs/libslang.so.1.4.9 \ + %{buildroot}%{_libdir}/libslang.so.1.4.9 +ln -sf /libslang.so.1.4.9 %{buildroot}%{_libdir}//libslang.so.1 +%endif + +chmod 755 %{buildroot}%{_libdir}/*.so.* + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%if %{build_compat_lib} +%post -n %{name}1 -p /sbin/ldconfig +%postun -n %{name}1 -p /sbin/ldconfig +%endif + +%files -n slang +%defattr(-,root,root) +%config %{_sysconfdir}/slsh.rc +%{_bindir}/slsh +%{_datadir}/slsh/* +%{_mandir}/man1/slsh.1* + +%files +%defattr(-,root,root) +%{_libdir}/*.so.* +%{_libdir}/slang/v2/modules/*-module.so +%if %{build_compat_lib} +%exclude %{_libdir}/libslang.so.1 +%exclude %{_libdir}/libslang.so.1.4.9 +%endif +%doc COPYING + +%if %{build_compat_lib} +%files -n %{name}1 +%defattr(-,root,root) +%{_libdir}/libslang.so.1 +%{_libdir}/libslang.so.1.4.9 +%endif + +%files devel +%defattr(-,root,root) +%{_includedir}/slang/*.h +%{_libdir}/*.so +%{_datadir}/doc/slang/v2/* +%{_docdir}/slsh/html/slshfun*.html +%{_libdir}/pkgconfig/slang.pc +%doc doc README + +%changelog +* Thu Jul 26 2012 Silvan Calarco 2.2.4-2mamba +- rebuilt with --enable-wide-chars +- build with libonig + +* Mon May 16 2011 Automatic Build System 2.2.4-1mamba +- automatic update by autodist + +* Wed Feb 23 2011 Automatic Build System 2.2.3-1mamba +- automatic update by autodist + +* Sun Apr 11 2010 Silvan Calarco 2.2.2-2mamba +- removed broken libslang-utf8 library link + +* Tue Mar 23 2010 Silvan Calarco 2.2.2-1mamba +- update to 2.2.2 + +* Tue Mar 23 2010 Silvan Calarco 2.1.4-2mamba +- build requirements fixed +- added slang subpackage + +* Fri Dec 12 2008 Silvan Calarco 2.1.4-1mamba +- update to 2.1.4 + +* Sun May 18 2008 Silvan Calarco 2.0.7-1mamba +- update to 2.0.7 +- libslang1 legacy package: disabled and obsoleted + +* Tue Jan 31 2006 Davide Madrisan 2.0.5-1qilnx +- update to version 2.0.5 by autospec +- new compatiblity package libslang1 + +* Tue Jan 31 2006 Davide Madrisan 1.4.9-3qilnx +- UTF-8 fixes + +* Mon Sep 12 2005 Davide Madrisan 1.4.9-2qilnx +- specfile fixes and updates + +* Thu Apr 24 2003 Alessandro Ramazzina 1.4.9-1qilnx +- creation of slang package