[devel] Первая порция фиксов на libzvt
Alexey Morozov
=?iso-8859-1?q?morozov_=CE=C1_novosoft=2Eru?=
Вс Ноя 3 18:18:49 MSK 2002
Собственно, сабж.
Достижения:
1. Собирается automake-1.6/autoconf-2.5, хотя я не вижу причин, по которым
не должно собираться и старыми версиями :-). Впрочем, не проверял :-).
2. В заголовке терминала корректно отображаются не Latin-1 символы (ой, ну
и чехарда с многочисленными конвертациями между local charset <-> UTF-8
<-> UCS-4 у них там внутри :-)).
Проверять при помощи
zsh:
precmd () {print -Pn "\e]0;%n@%m: %~\a"}; mkdir тест; cd тест;
bash:
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"; mkdir тест; cd тест;
Да, если в эхе есть особы, приближенные к импе^H^H^H^H gnome-devel , я буду рад, если эти
патчи засабмиттятся туда. Влад, Вы этот список читаете? :-)
P.S. Да, to be continued :-). На очереди - нормальный маппинг кнопочек :-).
----------- следующая часть -----------
diff -urN libzvt-2.0.1.orig/acinclude.m4 libzvt-2.0.1/acinclude.m4
--- libzvt-2.0.1.orig/acinclude.m4 Thu Jan 1 07:00:00 1970
+++ libzvt-2.0.1/acinclude.m4 Sun Nov 3 18:12:03 2002
@@ -0,0 +1,244 @@
+# Checks for availability of various utmp fields
+#
+# Original code by Bernhard Rosenkraenzer (bero на linux.net.eu.org), 1998.
+# Modifications by Timur Bakeyev (timur на gnu.org), 1999.
+#
+
+dnl AC_CHECK_UTMP()
+dnl Test for presence of the field and define HAVE_UT_UT_field macro
+dnl
+
+AC_DEFUN(AC_CHECK_UTMP,[
+
+AC_CHECK_HEADERS(sys/time.h utmp.h utmpx.h)
+AC_HEADER_TIME
+
+if test "$ac_cv_header_utmpx_h" = "yes"; then
+ AC_DEFINE(UTMP,[struct utmpx])
+else
+ AC_DEFINE(UTMP,[struct utmp])
+fi
+
+dnl some systems (BSD4.4-like) require time.h to be included before utmp.h :/
+AC_MSG_CHECKING(for ut_host field in the utmp structure)
+AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#else
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#endif
+#ifdef HAVE_UTMP_H
+#include <utmp.h>
+#endif
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif],[UTMP ut; char *p; p=ut.ut_host;],result=yes,result=no)
+if test "$result" = "yes"; then
+ AC_DEFINE(HAVE_UT_UT_HOST)
+fi
+AC_MSG_RESULT($result)
+
+AC_MSG_CHECKING(for ut_pid field in the utmp structure)
+AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#else
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#endif
+#ifdef HAVE_UTMP_H
+#include <utmp.h>
+#endif
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif],[UTMP ut; int i; i=ut.ut_pid;],result=yes,result=no)
+if test "$result" = "yes"; then
+ AC_DEFINE(HAVE_UT_UT_PID)
+fi
+AC_MSG_RESULT($result)
+
+AC_MSG_CHECKING(for ut_id field in the utmp structure)
+AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#else
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#endif
+#ifdef HAVE_UTMP_H
+#include <utmp.h>
+#endif
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif],[UTMP ut; char *p; p=ut.ut_id;],result=yes,result=no)
+if test "$result" = "yes"; then
+ AC_DEFINE(HAVE_UT_UT_ID)
+fi
+AC_MSG_RESULT($result)
+
+AC_MSG_CHECKING(for ut_name field in the utmp structure)
+AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#else
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#endif
+#ifdef HAVE_UTMP_H
+#include <utmp.h>
+#endif
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif],[UTMP ut; char *p; p=ut.ut_name;],result=yes,result=no)
+if test "$result" = "yes"; then
+ AC_DEFINE(HAVE_UT_UT_NAME)
+fi
+AC_MSG_RESULT($result)
+
+AC_MSG_CHECKING(for ut_type field in the utmp structure)
+AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#else
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#endif
+#ifdef HAVE_UTMP_H
+#include <utmp.h>
+#endif
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif],[UTMP ut; int i; i=(int) ut.ut_type;],result=yes,result=no)
+if test "$result" = "yes"; then
+ AC_DEFINE(HAVE_UT_UT_TYPE)
+fi
+AC_MSG_RESULT($result)
+
+AC_MSG_CHECKING(for ut_exit.e_termination field in the utmp structure)
+AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#else
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#endif
+#ifdef HAVE_UTMP_H
+#include <utmp.h>
+#endif
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif],[UTMP ut; ut.ut_exit.e_termination=0;],result=yes,result=no)
+if test "$result" = "yes"; then
+ AC_DEFINE(HAVE_UT_UT_EXIT_E_TERMINATION)
+fi
+AC_MSG_RESULT($result)
+
+AC_MSG_CHECKING(for ut_user field in the utmp structure)
+AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#else
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#endif
+#ifdef HAVE_UTMP_H
+#include <utmp.h>
+#endif
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif],[UTMP ut; char *p; p=ut.ut_user;],result=yes,result=no)
+if test "$result" = "yes"; then
+ AC_DEFINE(HAVE_UT_UT_USER)
+fi
+AC_MSG_RESULT($result)
+
+AC_MSG_CHECKING(for ut_time field in the utmp structure)
+AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#else
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#endif
+#ifdef HAVE_UTMP_H
+#include <utmp.h>
+#endif
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif],[UTMP ut; ut.ut_time=0;],result=yes,result=no)
+if test "$result" = "yes"; then
+ AC_DEFINE(HAVE_UT_UT_TIME)
+fi
+AC_MSG_RESULT($result)
+
+AC_MSG_CHECKING(for ut_tv field in the utmp structure)
+AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#else
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#endif
+#ifdef HAVE_UTMP_H
+#include <utmp.h>
+#endif
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif],[UTMP ut; ut.ut_tv={0, 0};],result=yes,result=no)
+if test "$result" = "yes"; then
+ AC_DEFINE(HAVE_UT_UT_TV)
+fi
+AC_MSG_RESULT($result)
+
+AC_MSG_CHECKING(for ut_syslen field in the utmp structure)
+AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#else
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#endif
+#ifdef HAVE_UTMP_H
+#include <utmp.h>
+#endif
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif],[UTMP ut; ut.ut_syslen=0;],result=yes,result=no)
+if test "$result" = "yes"; then
+ AC_DEFINE(HAVE_UT_UT_SYSLEN)
+fi
+AC_MSG_RESULT($result)
+
+])
+
diff -urN libzvt-2.0.1.orig/libzvt/Makefile.am libzvt-2.0.1/libzvt/Makefile.am
--- libzvt-2.0.1.orig/libzvt/Makefile.am Sun Nov 3 17:51:39 2002
+++ libzvt-2.0.1/libzvt/Makefile.am Sun Nov 3 18:09:38 2002
@@ -79,10 +79,9 @@
gnome_pty_helper_SOURCES= \
gnome-pty-helper.c \
- gnome-login-support.c \
gnome-utmp.c
-gnome_pty_helper_LDADD= $(UTIL_LIBS)
+gnome_pty_helper_LDADD= $(UTIL_LIBS) gnome-login-support.$(OBJEXT)
# Since we do gnome-pty-helper manually, include the relevant sources here
EXTRA_DIST = TODO BUGS README \
----------- следующая часть -----------
--- libzvt-2.0.1.orig/libzvt/vt.c Sun Nov 3 17:51:39 2002
+++ libzvt-2.0.1/libzvt/vt.c Sun Nov 3 18:49:27 2002
@@ -1413,40 +1413,11 @@
/* XPROPERTY sets an XA_STRING in gnome-terminal and must
* therefore be Latin-1 unless gnome-terminal is on crack.
- * We'll assume the title/iconname are in locale encoding, since
- * AFAIK they aren't tagged for encoding. xterm seems to treat
- * them as locale encoding.
+ * The processing code automatically converts data into
+ * UTF-8, so we don't have to bother ourselves...
*/
-
- if (i == VTTITLE_XPROPERTY)
- {
- const char *s;
- GString *str;
-
- str = g_string_new ("");
-
- s = p;
- while (*s)
- {
- g_string_append_unichar (str, *s);
- ++s;
- }
-
- utf8 = g_string_free (str, FALSE);
- }
- else
- {
- utf8 = zvt_term_locale_to_utf8 (p, -1, NULL, NULL, NULL);
- /* utf8 will be NULL if the title was not valid
- * in the locale encoding
- */
- }
-
- if (utf8)
- {
- vt->change_my_name (vt->user_data, utf8, i);
- g_free (utf8);
- }
+ if (p)
+ vt->change_my_name (vt->user_data, p, i);
}
}
}
@@ -1766,8 +1737,15 @@
} else if (c==0x0a) {
state = 0; /* abort command */
} else {
+#ifdef HAS_I18N
+ if (vt->arg.txt.outptr + 6 <(vt->arg.txt.args_mem+VTPARAM_MAXARGS*VTPARAM_ARGMAX-2)) {/* truncate excessive args */
+ gint len = g_unichar_to_utf8(c, vt->arg.txt.outptr);
+ vt->arg.txt.outptr += len;
+ }
+#else
if (vt->arg.txt.outptr<(vt->arg.txt.args_mem+VTPARAM_MAXARGS*VTPARAM_ARGMAX-2)) /* truncate excessive args */
*(vt->arg.txt.outptr)++=c;
+#endif
}
break;
----------- следующая часть -----------
--- libzvt.spec.orig Sun Oct 6 20:20:48 2002
+++ libzvt.spec Sun Nov 3 18:56:00 2002
@@ -1,12 +1,11 @@
Name: libzvt
Version: 2.0.1
-Release: alt3
+Release: alt3.aam1
Summary: Zed's Virtual Terminal widget library
License: LGPL
Group: System/Libraries
Url: ftp://ftp.gnome.org
-Packager: Yuri N. Sedunov <aris на altlinux.ru>
Source: %name-%version.tar.bz2
# patch to make utf-8 mode the default if the locale is utf-8
@@ -17,6 +16,10 @@
# enforce pty helper path in all execl parameters
Patch2: %name-2.0.1-mdk-ptyhelper.patch.bz2
+# Local patches
+Patch11: %name-2.0.1-automake.patch
+Patch12: %name-2.0.1-i18n-fix.patch
+
%define gtk2_ver 2.1.0
%define glib2_ver 2.0.6
%define libart_lgpl_ver 2.3.8
@@ -65,10 +68,14 @@
%patch -p1
%patch1 -p1
%patch2 -p1
+%patch11 -p1
+%patch12 -p1
%build
# needed by patch1
-%__automake
+aclocal
+%__automake -a
+%__autoconf
%configure
%make_build
@@ -96,6 +103,12 @@
%_libdir/*.a
%changelog
+* Sun Nov 03 2002 Alexey Morozov <morozov на novosoft.ru> 2.0.1-alt3.aam1
+- A patch and spec fixes for automake-1.6/autoconf-2.5x (should be
+ backward compatible with older version but I'm not sure about that)
+- A fix for proper localized title displaying (especially useful for
+ non-Latin1 directory names and famous \e]0...\a escape-sequence
+
* Sun Oct 06 2002 Yuri N. Sedunov <aris на altlinux.ru> 2.0.1-alt3
- rebuild with new pango, gtk+
Подробная информация о списке рассылки Devel