summaryrefslogtreecommitdiff
path: root/example.c
diff options
context:
space:
mode:
Diffstat (limited to 'example.c')
-rw-r--r--example.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/example.c b/example.c
index 656ab37..5b3404a 100644
--- a/example.c
+++ b/example.c
@@ -95,7 +95,11 @@ void test_gzio(out, in, uncompr, uncomprLen)
95 exit(1); 95 exit(1);
96 } 96 }
97 gzputc(file, 'h'); 97 gzputc(file, 'h');
98 if (gzprintf(file, "%s, %s!", "ello", "hello") != len-2) { 98 if (gzputs(file, "ello") != 4) {
99 fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err));
100 exit(1);
101 }
102 if (gzprintf(file, ", %s!", "hello") != 8) {
99 fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); 103 fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err));
100 exit(1); 104 exit(1);
101 } 105 }
@@ -132,16 +136,17 @@ void test_gzio(out, in, uncompr, uncomprLen)
132 exit(1); 136 exit(1);
133 } 137 }
134 138
135 uncomprLen = gzread(file, uncompr, (unsigned)uncomprLen); 139 gzgets(file, (char*)uncompr, uncomprLen);
136 if (uncomprLen != 7) { 140 uncomprLen = strlen((char*)uncompr);
137 fprintf(stderr, "gzread err after gzseek: %s\n", gzerror(file, &err)); 141 if (uncomprLen != 6) { /* "hello!" */
142 fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err));
138 exit(1); 143 exit(1);
139 } 144 }
140 if (strcmp((char*)uncompr, hello+7)) { 145 if (strcmp((char*)uncompr, hello+7)) {
141 fprintf(stderr, "bad gzread after gzseek\n"); 146 fprintf(stderr, "bad gzgets after gzseek\n");
142 exit(1); 147 exit(1);
143 } else { 148 } else {
144 printf("gzread() after gzseek: %s\n", uncompr); 149 printf("gzgets() after gzseek: %s\n", uncompr);
145 } 150 }
146 151
147 gzclose(file); 152 gzclose(file);