diff options
author | peter <peter@FreeBSD.org> | 1999-01-10 09:47:00 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-01-10 09:47:00 +0000 |
commit | b66130e248e76492a053cf3cb3fe84f580668361 (patch) | |
tree | 3caf4fc6f883e76264c0a8d3c81387ebbb685ebf /lib/libz/example.c | |
parent | 9f86c0bf8cf1224d46bbefe1d308f2cc8186a79b (diff) | |
download | FreeBSD-src-b66130e248e76492a053cf3cb3fe84f580668361.zip FreeBSD-src-b66130e248e76492a053cf3cb3fe84f580668361.tar.gz |
Import zlib 1.1.3 onto the vendor branch.
Obtained from: ftp.cdrom.com:/pub/infozip/zlib
Diffstat (limited to 'lib/libz/example.c')
-rw-r--r-- | lib/libz/example.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/libz/example.c b/lib/libz/example.c index 5b3404a..8307c84 100644 --- a/lib/libz/example.c +++ b/lib/libz/example.c @@ -15,6 +15,12 @@ extern void exit OF((int)); #endif +#if defined(VMS) || defined(RISCOS) +# define TESTFILE "foo-gz" +#else +# define TESTFILE "foo.gz" +#endif + #define CHECK_ERR(err, msg) { \ if (err != Z_OK) { \ fprintf(stderr, "%s error: %d\n", msg, err); \ @@ -71,7 +77,7 @@ void test_compress(compr, comprLen, uncompr, uncomprLen) fprintf(stderr, "bad uncompress\n"); exit(1); } else { - printf("uncompress(): %s\n", uncompr); + printf("uncompress(): %s\n", (char *)uncompr); } } @@ -79,8 +85,8 @@ void test_compress(compr, comprLen, uncompr, uncomprLen) * Test read/write of .gz files */ void test_gzio(out, in, uncompr, uncomprLen) - const char *out; /* output file */ - const char *in; /* input file */ + const char *out; /* compressed output file */ + const char *in; /* compressed input file */ Byte *uncompr; int uncomprLen; { @@ -121,13 +127,13 @@ void test_gzio(out, in, uncompr, uncomprLen) fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); exit(1); } else { - printf("gzread(): %s\n", uncompr); + printf("gzread(): %s\n", (char *)uncompr); } pos = gzseek(file, -8L, SEEK_CUR); if (pos != 6 || gztell(file) != pos) { fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", - pos, gztell(file)); + (long)pos, (long)gztell(file)); exit(1); } @@ -146,7 +152,7 @@ void test_gzio(out, in, uncompr, uncomprLen) fprintf(stderr, "bad gzgets after gzseek\n"); exit(1); } else { - printf("gzgets() after gzseek: %s\n", uncompr); + printf("gzgets() after gzseek: %s\n", (char *)uncompr); } gzclose(file); @@ -227,7 +233,7 @@ void test_inflate(compr, comprLen, uncompr, uncomprLen) fprintf(stderr, "bad inflate\n"); exit(1); } else { - printf("inflate(): %s\n", uncompr); + printf("inflate(): %s\n", (char *)uncompr); } } @@ -406,7 +412,7 @@ void test_sync(compr, comprLen, uncompr, uncomprLen) err = inflateEnd(&d_stream); CHECK_ERR(err, "inflateEnd"); - printf("after inflateSync(): hel%s\n", uncompr); + printf("after inflateSync(): hel%s\n", (char *)uncompr); } /* =========================================================================== @@ -492,7 +498,7 @@ void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) fprintf(stderr, "bad inflate with dict\n"); exit(1); } else { - printf("inflate with dictionary: %s\n", uncompr); + printf("inflate with dictionary: %s\n", (char *)uncompr); } } @@ -528,8 +534,8 @@ int main(argc, argv) } test_compress(compr, comprLen, uncompr, uncomprLen); - test_gzio((argc > 1 ? argv[1] : "foo.gz"), - (argc > 2 ? argv[2] : "foo.gz"), + test_gzio((argc > 1 ? argv[1] : TESTFILE), + (argc > 2 ? argv[2] : TESTFILE), uncompr, (int)uncomprLen); test_deflate(compr, comprLen); |