You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-text/vilistextum/files/vilistextum-2.6.7-use-glibc...

491 lines
16 KiB

diff -uwr vilistextum-2.6.7/CHANGES vilistextum-2.6.7-gentoo/CHANGES
--- vilistextum-2.6.7/CHANGES 2004-12-20 00:05:47.000000000 +0100
+++ vilistextum-2.6.7-gentoo/CHANGES 2005-01-02 09:14:58.000000000 +0100
@@ -1,9 +1,15 @@
+2.6.7-gentoo: (02.01.2005)
+
+ - configure fixed to correctly process --disable-multibyte
+ - configure falls back to standard iconv() if no libiconv is found
+ - BUGFIX: three off-by-one error in get_attr found by Ewald Dieterich
+
2.6.7: (19.12.2004)
- - BUGFIX: buffer overflow in get_attr found by Ariel Berkman
+ - BUGFIX: buffer overflow in get_attr() found by Ariel Berkman
- BUGFIX: compilation fix for Solaris by Fredrik Roubert
- more robust behaviour when encountering invalid byte sequences
- - added RPM-spec file by Joshua Jensen.
+ - added RPM-spec file by Joshua Jensen
2.6.6: (24.08.2004)
diff -uwr vilistextum-2.6.7/INSTALL vilistextum-2.6.7-gentoo/INSTALL
--- vilistextum-2.6.7/INSTALL 2004-04-20 12:10:18.000000000 +0200
+++ vilistextum-2.6.7-gentoo/INSTALL 2004-12-22 21:49:20.000000000 +0100
@@ -11,7 +11,7 @@
Multibyte/Unicode version
=========================
-./configure --enable && make && make install
+./configure --enable-multibyte && make && make install
The multibyte version needs libiconv.
http://www.gnu.org/software/libiconv
diff -uwr vilistextum-2.6.7/config.h.in vilistextum-2.6.7-gentoo/config.h.in
--- vilistextum-2.6.7/config.h.in 2004-12-20 00:05:48.000000000 +0100
+++ vilistextum-2.6.7-gentoo/config.h.in 2005-01-02 09:14:59.000000000 +0100
@@ -3,6 +3,9 @@
/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
+/* Define to 1 if you have the <iconv.h> header file. */
+#undef HAVE_ICONV_H
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
diff -uwr vilistextum-2.6.7/configure vilistextum-2.6.7-gentoo/configure
--- vilistextum-2.6.7/configure 2004-12-20 00:05:32.000000000 +0100
+++ vilistextum-2.6.7-gentoo/configure 2005-01-02 09:13:56.000000000 +0100
@@ -846,7 +846,7 @@
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-dependency-tracking Speeds up one-time builds
--enable-dependency-tracking Do not reject slow dependency extractors
- --enable-multibyte Enable multibyte support. Needs libiconv.
+ --enable-multibyte Enable multibyte support.
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1541,7 +1541,7 @@
# Define the identity of the package.
PACKAGE=vilistextum
- VERSION=2.6.7
+ VERSION=2.6.7-gentoo
cat >>confdefs.h <<_ACEOF
@@ -1673,7 +1673,7 @@
cat >>confdefs.h <<_ACEOF
-#define RELEASEDATE "19.12.2004"
+#define RELEASEDATE "02.01.2005"
_ACEOF
@@ -3615,13 +3615,14 @@
# Check whether --enable-multibyte or --disable-multibyte was given.
if test "${enable_multibyte+set}" = set; then
enableval="$enable_multibyte"
- multibyte="yes"
+ use_multibyte=$enableval
else
- multibyte="no"
+ use_multibyte=no
fi;
-echo "$as_me:$LINENO: result: $multibyte" >&5
-echo "${ECHO_T}$multibyte" >&6
-if test "$multibyte" = "yes"; then
+echo "$as_me:$LINENO: result: $use_multibyte" >&5
+echo "${ECHO_T}$use_multibyte" >&6
+
+if test "$use_multibyte" = "yes"; then
cat >>confdefs.h <<\_ACEOF
#define MULTIBYTE 1
@@ -3629,7 +3630,154 @@
fi
-if test "$multibyte" = "yes"; then
+if test "$use_multibyte" = "yes"; then
+
+for ac_header in iconv.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+ { { echo "$as_me:$LINENO: error: Need libiconv or iconv.h for multibyte support" >&5
+echo "$as_me: error: Need libiconv or iconv.h for multibyte support" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+done
+
+
echo "$as_me:$LINENO: checking for iconv in -liconv" >&5
echo $ECHO_N "checking for iconv in -liconv... $ECHO_C" >&6
@@ -3693,9 +3841,8 @@
LIBS="-liconv $LIBS"
else
- { { echo "$as_me:$LINENO: error: Need libiconv for multibyte support" >&5
-echo "$as_me: error: Need libiconv for multibyte support" >&2;}
- { (exit 1); exit 1; }; }
+ { echo "$as_me:$LINENO: WARNING: only generic iconv has been found not libiconv" >&5
+echo "$as_me: WARNING: only generic iconv has been found not libiconv" >&2;}
fi
diff -uwr vilistextum-2.6.7/configure.in vilistextum-2.6.7-gentoo/configure.in
--- vilistextum-2.6.7/configure.in 2004-12-20 00:05:14.000000000 +0100
+++ vilistextum-2.6.7-gentoo/configure.in 2005-01-02 09:13:30.000000000 +0100
@@ -1,11 +1,11 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/debug.h)
-AM_INIT_AUTOMAKE(vilistextum, 2.6.7)
+AM_INIT_AUTOMAKE(vilistextum, 2.6.7-gentoo)
AM_CONFIG_HEADER(config.h)
dnl Set current date
-AC_DEFINE_UNQUOTED(RELEASEDATE, "19.12.2004", "Release date of the program")
+AC_DEFINE_UNQUOTED(RELEASEDATE, "02.01.2005", "Release date of the program")
dnl Checks for programs.
AC_PROG_CC
@@ -27,17 +27,21 @@
dnl checking for options
AC_MSG_CHECKING(if --enable-multibyte specified)
AC_ARG_ENABLE(multibyte,
- [ --enable-multibyte Enable multibyte support. Needs libiconv.],
- [multibyte="yes"], [multibyte="no"])
-AC_MSG_RESULT($multibyte)
-if test "$multibyte" = "yes"; then
+ AC_HELP_STRING([--enable-multibyte], [Enable multibyte support.]),
+ [use_multibyte=$enableval], [use_multibyte=no])
+AC_MSG_RESULT($use_multibyte)
+
+if test "$use_multibyte" = "yes"; then
AC_DEFINE(MULTIBYTE, 1, "Enable multibyte support (e.g. unicode, shift_jis)")
fi
dnl Checks for libraries.
-if test "$multibyte" = "yes"; then
+if test "$use_multibyte" = "yes"; then
+AC_CHECK_HEADERS(iconv.h,,
+ AC_MSG_ERROR(Need libiconv or iconv.h for multibyte support))
+
AC_CHECK_LIB(iconv, iconv,,
- AC_MSG_ERROR(Need libiconv for multibyte support))
+ AC_MSG_WARN(only generic iconv has been found not libiconv))
dnl setting INTERNAL_LOCALE
AC_MSG_CHECKING(for unicode locale)
diff -uwr vilistextum-2.6.7/src/fileio.c vilistextum-2.6.7-gentoo/src/fileio.c
--- vilistextum-2.6.7/src/fileio.c 2004-12-19 22:08:08.000000000 +0100
+++ vilistextum-2.6.7-gentoo/src/fileio.c 2004-12-22 21:29:34.000000000 +0100
@@ -27,11 +27,6 @@
#ifdef MULTIBYTE
#include <iconv.h>
#include <locale.h>
- #if defined(__sun__)
- #include <libcharset.h>
- #else
- #include <localcharset.h>
- #endif
#endif
FILE *in, *out;
@@ -74,32 +69,42 @@
char *inp, *outp;
int fehlernr=0;
size_t insize, outsize;
+ char *ret;
/* set locale based on environment variables */
- setlocale(LC_CTYPE, "");
+ ret = setlocale(LC_CTYPE, "");
+ if (ret==NULL) {
+ fprintf(stderr, "setlocale failed with: %s\n\n", getenv("LC_CTYPE"));
+ exit(1);
+ }
insize = strlen(str);
+ if (insize > DEF_STR_LEN) { insize = DEF_STR_LEN; }
outsize = DEF_STR_LEN;
inp = str;
outp = output;
if ((conv = iconv_open("utf-8", "char"))==(iconv_t)(-1))
- { printf("iconv_open failed in convert_string: Can't convert from %s to UTF-8?\n", locale_charset()); exit(1); }
+ { printf("iconv_open failed in convert_string: Can't convert from %s to UTF-8?\n", getenv("LC_CTYPE")); exit(1); }
result = iconv(conv, &inp, &insize, &outp, &outsize);
fehlernr = errno;
if (fehlernr==E2BIG) { fprintf(stderr, "errno==E2BIG\n"); }
else if (fehlernr==EILSEQ) {
- fprintf(stderr, "Can't convert '%s' as character set %s\n", str, locale_charset());
+ fprintf(stderr, "Can't interpret '%s' as character from charset %s\n", str, getenv("LC_CTYPE"));
fprintf(stderr, "Check your language settings with locale(1)\n");
}
else if (fehlernr==EINVAL) { fprintf(stderr, "errno==EINVAL\n"); }
output[strlen(output)] = '\0';
- setlocale(LC_CTYPE, INTERNAL_LOCALE);
+ ret = setlocale(LC_CTYPE, INTERNAL_LOCALE);
+ if (ret==NULL) {
+ fprintf(stderr, "setlocale failed with: %s\n\n", INTERNAL_LOCALE);
+ exit(1);
+ }
mbstowcs(converted_string, output, strlen(output));
iconv_close(conv);
@@ -141,7 +146,7 @@
fehlernr = errno;
if (fehlernr==E2BIG) { fprintf(stderr, "errno==E2BIG\n"); }
- else if (fehlernr==EILSEQ) { fprintf(stderr, "errno==EILSEQ in output_string\n"); }
+ else if (fehlernr==EILSEQ) { fprintf(stderr, "errno==EILSEQ in output_string\n"); fprintf(stderr, "input: %s\n", inp); }
else if (fehlernr==EINVAL) { fprintf(stderr, "errno==EINVAL\n"); }
output[DEF_STR_LEN-outsize] = '\0';
diff -uwr vilistextum-2.6.7/src/html.c vilistextum-2.6.7-gentoo/src/html.c
--- vilistextum-2.6.7/src/html.c 2004-12-19 22:08:17.000000000 +0100
+++ vilistextum-2.6.7-gentoo/src/html.c 2004-12-22 17:19:37.000000000 +0100
@@ -95,9 +95,8 @@
while ((ch!='=') && (ch!='>')) {
ch=read_char();
if (i<DEF_STR_LEN) { attr_name[i++] = ch; }
- }
- if (i<DEF_STR_LEN) { attr_name[i-1] = '\0'; }
- else { attr_name[DEF_STR_LEN-1] = '\0'; }
+ } /* post cond: i<=DEF_STR_LEN */
+ attr_name[i-1] = '\0';
if (ch=='>') { attr_ctnt[0]='\0'; return '>'; }
@@ -116,11 +115,10 @@
i=0;
ch=read_char();
while(quote!=ch) {
- if (i<DEF_STR_LEN) { temp[i++] = ch; }
+ if (i<DEF_STR_LEN-1) { temp[i++] = ch; }
ch=read_char();
- }
- if (i<DEF_STR_LEN) { temp[i] = '\0'; }
- else { temp[DEF_STR_LEN] = '\0'; }
+ } /* post cond: i<=DEF_STR_LEN-1 */
+ temp[i] = '\0';
ch=read_char();
}
else
@@ -131,9 +129,8 @@
while ((ch!='>') && (!isspace(ch))) {
ch=read_char();
if (i<DEF_STR_LEN) { temp[i++] = ch; }
- }
- if (i<DEF_STR_LEN) { temp[i-1] = '\0'; }
- else { temp[DEF_STR_LEN-1] = '\0'; }
+ } /* post cond: i<=DEF_STR_LEN */
+ temp[i-1] = '\0';
}
uppercase_str(attr_name);
diff -uwr vilistextum-2.6.7/src/html_tag.c vilistextum-2.6.7-gentoo/src/html_tag.c
--- vilistextum-2.6.7/src/html_tag.c 2004-12-19 22:08:20.000000000 +0100
+++ vilistextum-2.6.7-gentoo/src/html_tag.c 2004-12-22 17:23:09.000000000 +0100
@@ -52,12 +52,10 @@
/* read html tag */
while ((ch!='>') && (ch!=' ') && (ch!=13) && (ch!=10))
{
- if (i<DEF_STR_LEN) { str[i] = ch; }
- i++;
+ if (i<DEF_STR_LEN-1) { str[i++] = ch; }
ch = uppercase(read_char());
- }
- if (i>=DEF_STR_LEN) { str[DEF_STR_LEN] = '\0'; }
- else { str[i] = '\0';}
+ } /* post cond: i<=DEF_STR_LEN-1 */
+ str[i] = '\0';
#ifdef debug
fprintf(stderr, "html_tag: %ls\n",str);
@@ -332,6 +330,8 @@
else if CMP("/SCRIPT", str) {}
else if CMP("STYLE", str) {}
else if CMP("/STYLE", str) {}
+ else if CMP("TITLE", str) {}
+ else if CMP("/TITLE", str) {}
else { if (errorlevel>=2) { print_error("tag ignored: ", str);} }
}
diff -uwr vilistextum-2.6.7/src/main.c vilistextum-2.6.7-gentoo/src/main.c
--- vilistextum-2.6.7/src/main.c 2004-12-19 22:08:30.000000000 +0100
+++ vilistextum-2.6.7-gentoo/src/main.c 2004-12-22 17:16:05.000000000 +0100
@@ -253,7 +253,7 @@
case 's':
shrink_lines = atoi(argument); if (shrink_lines==0) { shrink_lines = 1; } break;
- case 'r': remove_empty_alt = 1; /* printf("remove_empty_alt\n"); */ break;
+ case 'r': remove_empty_alt = 1; break;
case 'i':
#ifdef MULTIBYTE
convert_string(argument, user_image);
diff -uwr vilistextum-2.6.7/src/text.c vilistextum-2.6.7-gentoo/src/text.c
--- vilistextum-2.6.7/src/text.c 2004-12-19 22:08:41.000000000 +0100
+++ vilistextum-2.6.7-gentoo/src/text.c 2004-12-22 15:43:26.000000000 +0100
@@ -249,10 +249,12 @@
if (!palm)
{
+ if (wort_pos+len<DEF_STR_LEN) {
while (i<wort_pos+len) { wort[i] = s[j]; j++; i++; }
wort[i] = '\0';
wort_pos += len;
}
+ }
#ifdef proc_debug
printf("wort_plus_string_nocount() ende\n");
@@ -273,9 +275,11 @@
printf("s: %ls len: %d\n", s,len);
#endif
+ if (wort_pos+len<DEF_STR_LEN) {
while (i<wort_pos+len) { wort[i] = s[j]; j++; i++; }
wort[i] = '\0';
wort_pos += len; wort_len += len;
+ }
#ifdef proc_debug
printf("wort_plus_string() ende\n");