File gv-3.6.3-bzip2.patch of Package gv

--- configure.ac
+++ configure.ac	2008-03-27 14:41:36.332982541 +0100
@@ -49,6 +49,25 @@ dnl Search for libraries
 AC_CHECK_LIB(m, sqrt)
 AC_CHECK_LIB(fl, yywrap)
 
+#
+# Check for zlib and libbz2 libraries to use this together
+# with SuSE's libzio to open compressed info files.
+#
+AC_CHECK_HEADER(zlib.h,[
+  for lib in z gz
+  do
+    AC_CHECK_LIB($lib, gzopen, [LIBS="$LIBS -l$lib" ; break])
+  done])
+AC_CHECK_HEADER(bzlib.h,[
+  for lib in bz2 bzip2
+  do
+    AC_CHECK_LIB($lib, BZ2_bzopen, [LIBS="$LIBS -l$lib" ; break])
+  done])
+AC_CHECK_HEADER(zio.h,[
+    AC_CHECK_LIB(zio, fzopen, [LIBS="$LIBS -lzio" ; AC_DEFINE(HAVE_ZIO)])
+  ])
+
+
 AC_PATH_XTRA()
 AC_CHECK_LIB(X11, XOpenDisplay, , , $X_LIBS)
 AC_CHECK_LIB(ICE, main, , , $X_LIBS)
@@ -229,4 +248,4 @@ AM_CONDITIONAL(USE_MEMDEBUG_CODE, test x
 
 
 dnl Generate output files
-AC_OUTPUT(Makefile doc/version.texi lib/Makefile src/Makefile doc/Makefile)
\ No newline at end of file
+AC_OUTPUT(Makefile doc/version.texi lib/Makefile src/Makefile doc/Makefile)
--- src/ac_config.h.in
+++ src/ac_config.h.in	2008-03-27 14:43:32.755968935 +0100
@@ -142,3 +142,6 @@
 /* Define to rpl_ if the getopt replacement functions and variables should be
    used. */
 #undef __GETOPT_PREFIX
+
+/* Define to 1 if you have libzio for opening compressed info files */
+#undef HAVE_ZIO
--- src/ps.c
+++ src/ps.c	2008-03-27 15:33:19.813097964 +0100
@@ -65,8 +65,15 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #include <string.h>
+#include <ac_config.h>
+
+#ifdef HAVE_ZIO
+# include <zio.h>
+#endif
 
 #ifndef SEEK_SET
 #define SEEK_SET 0
@@ -93,7 +100,7 @@ extern Media *gv_medias;
 #define memset(a,b,c) bzero(a,c)
 #endif
 
-extern int sec_scanf(const char *, const char *, ...);
+extern int sec_sscanf(const char *, const char *, ...);
 
 /* We use this helper function for providing proper */
 /* case and colon :-) insensitive DSC matching */
@@ -388,6 +395,7 @@ psscan(fileP,filename,filename_raw,filen
 	cmd_uncompress=NULL;
       }
     }
+#ifndef HAVE_ZIO
     if (cmd_uncompress) {
       struct document *retval = NULL;
       FILE *tmpfile = (FILE*)NULL;
@@ -441,6 +449,23 @@ unc_ok:
       *filename_uncP = (char*)GV_XtNewString(filename_unc);
       goto unc_ok;
     }
+#else
+    if (cmd_uncompress) {
+      FILE *zfile = fzopen(filename, "r");
+      INFMESSAGE(is compressed)
+      if (!zfile) {
+	char s[512];
+	sprintf(s,"Uncompressing of\n%s\nfailed.",filename);
+	NotePopupShowMessage(s);
+	ENDMESSAGE(psscan)
+	return(NULL);
+      }
+      fclose(*fileP);
+      *fileP = zfile;
+      cmd_uncompress = NULL;
+      *filename_uncP = NULL;
+    }
+#endif
 
     respect_eof = (scanstyle & SCANSTYLE_IGNORE_EOF) ? 0 : 1;
     ignore_dsc = (scanstyle & SCANSTYLE_IGNORE_DSC) ? 1 : 0;
openSUSE Build Service is sponsored by