I have applied the patch from Roberto Sanchez and done an NMU of the
package. Attached is the exact diff; it differs from Roberto's only in
the changelog.

-- 
Latest nerd movie: Once were hackers
diff -u xosview-1.8.2/config/configure.in xosview-1.8.2/config/configure.in
--- xosview-1.8.2/config/configure.in
+++ xosview-1.8.2/config/configure.in
@@ -10,6 +10,74 @@
 ICE_CXX_LONG_LONG
 AC_PATH_X
 CXXFLAGS="$CXXFLAGS -I$x_includes"
+
+dnl
+dnl Added a proper check for the snprintf() function
+dnl
+
+AC_DEFUN([AC_FUNC_SNPRINTF],
+[AC_CHECK_FUNCS(snprintf vsnprintf)
+AC_MSG_CHECKING(for working snprintf)
+AC_CACHE_VAL(ac_cv_have_working_snprintf,
+[AC_TRY_RUN(
+[#include <stdio.h>
+
+int main(void)
+{
+    char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
+    char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
+    int i;
+    i = snprintf (bufs, 2, "%s", "111");
+    if (strcmp (bufs, "1")) exit (1);
+    if (i != 3) exit (1);
+    i = snprintf (bufd, 2, "%d", 111);
+    if (strcmp (bufd, "1")) exit (1);
+    if (i != 3) exit (1);
+    exit(0);
+}], ac_cv_have_working_snprintf=yes, ac_cv_have_working_snprintf=no, ac_cv_have_working_snprintf=cross)])
+AC_MSG_RESULT([$ac_cv_have_working_snprintf])
+AC_MSG_CHECKING(for working vsnprintf)
+AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
+[AC_TRY_RUN(
+[#include <stdio.h>
+#include <stdarg.h>
+
+int my_vsnprintf (char *buf, const char *tmpl, ...)
+{
+    int i;
+    va_list args;
+    va_start (args, tmpl);
+    i = vsnprintf (buf, 2, tmpl, args);
+    va_end (args);
+    return i;
+}
+
+int main(void)
+{
+    char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
+    char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
+    int i;
+    i = my_vsnprintf (bufs, "%s", "111");
+    if (strcmp (bufs, "1")) exit (1);
+    if (i != 3) exit (1);
+    i = my_vsnprintf (bufd, "%d", 111);
+    if (strcmp (bufd, "1")) exit (1);
+    if (i != 3) exit (1);
+    exit(0);
+}], ac_cv_have_working_vsnprintf=yes, ac_cv_have_working_vsnprintf=no, ac_cv_have_working_vsnprintf=cross)])
+AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
+if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
+  AC_LIBOBJ(snprintf)
+  AC_MSG_WARN([Replacing missing/broken (v)snprintf() with version from http://www.ijs.si/software/snprintf/.])
+  AC_DEFINE(PREFER_PORTABLE_SNPRINTF, 1, "enable replacement (v)snprintf if system (v)snprintf is broken")
+fi])
+
+AC_FUNC_SNPRINTF
+
+dnl
+dnl End snprintf() check
+dnl
+
 case $host_os in
 linux*)
   LIBS="-L$x_libraries $LIBS"
diff -u xosview-1.8.2/debian/changelog xosview-1.8.2/debian/changelog
--- xosview-1.8.2/debian/changelog
+++ xosview-1.8.2/debian/changelog
@@ -1,3 +1,13 @@
+xosview (1.8.2-8.1) unstable; urgency=low
+
+  * Non-maintainer upload by Lars Wirzenius using patch by Roberto 
+    C. Sanchez <[EMAIL PROTECTED]> from the bug tracking system.
+  * Added portable check for snprintf to configure.in using code from
+    file:///usr/share/doc/autoconf-archive/htmldoc/ac_func_snprintf.html.
+    (Closes: #364629)
+
+ -- Lars Wirzenius <[EMAIL PROTECTED]>  Sat, 21 May 2006 07:09:00 +0300
+
 xosview (1.8.2-8) unstable; urgency=low
 
   * Substituted build-dependency on xlibs-dev for its component packages

Reply via email to