uInt len; int done = 0;
extern int EXPORT    gzflush OF((gzFile file, int flush))#endif{    uInt len;    int done = 0;    gz_stream *s = (gz_stream*)file;    if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;    s->stream.avail_in = 0; /* should be zero already anyway */    for (;;) {        len = Z_BUFSIZE - s->stream.avail_out;        if (len != 0) {            if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) {                s->z_err = Z_ERRNO;                return Z_ERRNO;            }            s->stream.next_out = s->outbuf;            s->stream.avail_out = Z_BUFSIZE;        }        if (done) break;        s->z_err = deflate(&(s->stream), flush);        /* deflate has finished flushing only when it hasn't used up         * all the available space in the output buffer:          */        done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END);         if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break;    }    fflush(s->file);    return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err;}