aboutsummaryrefslogtreecommitdiffstats
path: root/inflate.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-01-31 09:43:14 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-01-31 09:43:14 +0000
commit1b020138f9c6928c2d57b986715dbf759f65987d (patch)
tree97177d48a18332b766fb9891a994885f539e90ec /inflate.c
parent[w3m-dev 02949] fix for #undef USE_MIGEMO (diff)
downloadw3m-1b020138f9c6928c2d57b986715dbf759f65987d.tar.gz
w3m-1b020138f9c6928c2d57b986715dbf759f65987d.zip
[w3m-dev 02955] compression_decoders error message
* file.c (uncompress_stream): redirect stderr * inflate.c (main): print error message From: Fumitoshi UKAI <ukai@debian.or.jp>
Diffstat (limited to 'inflate.c')
-rw-r--r--inflate.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/inflate.c b/inflate.c
index aec19a5..9b58101 100644
--- a/inflate.c
+++ b/inflate.c
@@ -1,4 +1,4 @@
-/* $Id: inflate.c,v 1.3 2001/11/24 02:01:26 ukai Exp $ */
+/* $Id: inflate.c,v 1.4 2002/01/31 09:43:15 ukai Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <zlib.h>
@@ -16,8 +16,10 @@ main(int argc, char **argv)
if (argc > 1) {
f = fopen(argv[1], "rb");
- if (!f)
+ if (!f) {
+ fprintf(stderr, "%s: cannot open %s\n", argv[0], argv[1]);
exit(1);
+ }
}
else
f = stdin;
@@ -26,8 +28,10 @@ main(int argc, char **argv)
s.zfree = Z_NULL;
s.opaque = Z_NULL;
status = inflateInit(&s);
- if (status != Z_OK)
+ if (status != Z_OK) {
+ fprintf(stderr, "%s: inflateInit() %s\n", argv[0], zError(status));
exit(1);
+ }
s.avail_in = 0;
s.next_out = (Bytef *) outbuf;
s.avail_out = sizeof(outbuf);
@@ -43,8 +47,10 @@ main(int argc, char **argv)
fwrite(outbuf, 1, sizeof(outbuf) - s.avail_out, stdout);
break;
}
- if (status != Z_OK)
+ if (status != Z_OK) {
+ fprintf(stderr, "%s: inflate() %s\n", argv[0], zError(status));
exit(1);
+ }
if (s.avail_out == 0) {
fwrite(outbuf, 1, sizeof(outbuf), stdout);
s.next_out = (Bytef *) outbuf;