-- see zlib.h -- */
| 330 | |
| 331 | /* -- see zlib.h -- */ |
| 332 | int ZEXPORT gzputs(gzFile file, const char *s) { |
| 333 | z_size_t len, put; |
| 334 | gz_statep state; |
| 335 | |
| 336 | /* get internal structure */ |
| 337 | if (file == NULL) |
| 338 | return -1; |
| 339 | state = (gz_statep)file; |
| 340 | |
| 341 | /* check that we're writing and that there's no error */ |
| 342 | if (state->mode != GZ_WRITE || state->err != Z_OK) |
| 343 | return -1; |
| 344 | |
| 345 | /* write string */ |
| 346 | len = strlen(s); |
| 347 | if ((int)len < 0 || (unsigned)len != len) { |
| 348 | gz_error(state, Z_STREAM_ERROR, "string length does not fit in int"); |
| 349 | return -1; |
| 350 | } |
| 351 | put = gz_write(state, s, len); |
| 352 | return put < len ? -1 : (int)len; |
| 353 | } |
| 354 | |
| 355 | #if defined(STDC) || defined(Z_HAVE_STDARG_H) |
| 356 | #include <stdarg.h> |