diff options
author | peter <peter@FreeBSD.org> | 1999-01-10 09:53:51 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-01-10 09:53:51 +0000 |
commit | 67d696bb6279a8160b637faab547f897d198dcbc (patch) | |
tree | a075f94f5fb1b4c98d4588db3f8ca675ccde9aa0 /lib/libz/example.c | |
parent | 220de345140182e6dd7f4c662050f3b9fdda2066 (diff) | |
download | FreeBSD-src-67d696bb6279a8160b637faab547f897d198dcbc.zip FreeBSD-src-67d696bb6279a8160b637faab547f897d198dcbc.tar.gz |
Merge changes from vendor branch (1.1.1 -> 1.1.3) into mainline.
Diffstat (limited to 'lib/libz/example.c')
-rw-r--r-- | lib/libz/example.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/lib/libz/example.c b/lib/libz/example.c index e313c55..ed718cb 100644 --- a/lib/libz/example.c +++ b/lib/libz/example.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* $FreeBSD$ */ +/* @(#) $Id: example.c,v 1.1.1.3 1999/01/10 09:46:54 peter Exp $ */ #include <stdio.h> #include "zlib.h" @@ -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); |