File libzio-0.9.dif of Package libzio

--- fzopen.3.in
+++ fzopen.3.in	2008-10-16 14:48:34.823680248 +0200
@@ -1,6 +1,8 @@
+'\" t -*- coding: UTF-8 -*-
 .\"
 .\" Copyright 2004 Werner Fink, 2004 SuSE LINUX AG, Germany.
 .\" Copyright 2006 Werner Fink, 2006 SuSE Products GmbH, Germany.
+.\" Copyright 2008 Werner Fink, 2008 SuSE Products GmbH, Germany.
 .\"
 .\" This program is free software; you can redistribute it and/or modify
 .\" it under the terms of the GNU General Public License as published by
@@ -100,12 +102,75 @@ only supports the suffixes
 .IR .z " and ".gz
 for gzipped files and
 .I .bz2
-for bzip2ed files.
+for bzip2ed files. All supported formats can be found in
+the following table:
+.IP
+.TS H
+allbox;
+c  l l l l l
+rb l l l l l.
+	fread	fwrite	fseek	suffix	library
+gzip	yes	yes	yes	.gz	-lz
+ bzip2	yes	yes	no	.bz2	-lbz2
+LZW	yes	no	no	.Z	 builtin
+lzma	yes	no	yes	.lzma	-llzmadec
+.TE
+.PP
 .PP
 On reading first the appropriate suffixes are checked
 if not provided. If no file is found the magic
 byte sequence at the beginning of the file is checked
 to detect a gzip or bzip2 file.
+.PP
+.\"
+.SH CONFIGURATION
+With the help of
+.BR autoconf (1)
+and a few lines in the common file
+.B configure.in
+found in many source packages a programmer or maintainer
+can extend the automatic configuration to find the
+appropriate libraries together with the libzio:
+.PP
+.IP
+.nf
+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(lzmadec.h,[
+    AC_CHECK_LIB(lzmadec, lzmadec_read, [LIBS="$LIBS -l$lib"])
+  ])
+AC_CHECK_HEADER(zio.h,[
+    AC_CHECK_LIB(zio, fzopen, [LIBS="$LIBS -lzio"
+	AC_DEFINE(HAVE_ZIO)])
+  ])
+.fi
+.PP
+combined with two lines in the common file
+.B config.h.in
+like
+.PP
+.RS 1c
+.nf
+/* Define to 1 if you have libzio for opening compressed files */
+#undef HAVE_ZIO
+.fi
+.RE
+.PP
+it is easy to use the
+.BR cpp (1)
+macro
+.I HAVE_ZIO
+for the usage of
+.B fzopen
+instead of
+.BR fopen (3).
+.PP
 .\"
 .SH RETURN VALUES
 Upon  successful  completion
@@ -215,7 +280,7 @@ functions of the e.g.
 .\"
 .BR /usr/include/zio.h
 .SH SEE ALSO
-.BR fopen (8),
+.BR fopen (3),
 .br
 .BR gzip (1),
 .br
@@ -229,7 +294,8 @@ functions of the e.g.
 .br
 .BR /usr/include/lzmadec.h .
 .PP
-Further informations about Programming Custom Streams
+Further informations about
+.B Programming Custom Streams
 can be found by using the command
 .IP
 .B info libc 'Custom streams'
@@ -243,5 +309,8 @@ does not exist (yet).
 .br
 2006 Werner Fink,
 2006 SuSE Products GmbH, Germany.
+.br
+2008 Werner Fink,
+2008 SuSE Products GmbH, Germany.
 .SH AUTHOR
 Werner Fink <werner@suse.de>
--- zio.c
+++ zio.c	2008-09-24 17:50:43.000000000 +0200
@@ -189,7 +189,7 @@ FILE * fzopen(const char * path, const c
 	what = 'Z';
     else if (strcmp(path + len - 4, ".bz2" ) == 0)
 	what = 'b';
-    else if (strcmp(path + len - 4, ".lzma") == 0)
+    else if (strcmp(path + len - 5, ".lzma") == 0)
 	what = 'l';
 
     if (what == 'n' && *check == 'r') {
openSUSE Build Service is sponsored by