Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 1 | .TH "ZIP_CLOSE" "3" "February 13, 2012" "NiH" "Library Functions Manual" |
| 2 | .nh |
| 3 | .if n .ad l |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 4 | .SH "NAME" |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 5 | \fBzip_close\fR |
| 6 | \- close zip archive |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 7 | .SH "LIBRARY" |
Thomas Klausner | 201d1b2 | 2003-12-27 22:51:30 +0000 | [diff] [blame] | 8 | libzip (-lzip) |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 9 | .SH "SYNOPSIS" |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 10 | \fB#include <zip.h>\fR |
| 11 | .sp |
| 12 | \fIint\fR |
Thomas Klausner | 193739d | 2014-10-08 12:37:24 +0200 | [diff] [blame] | 13 | .PD 0 |
| 14 | .HP 4n |
| 15 | \fBzip_close\fR(\fIzip_t\ *archive\fR); |
| 16 | .PD |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 17 | .SH "DESCRIPTION" |
| 18 | The |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 19 | \fBzip_close\fR() |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 20 | function closes |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 21 | \fIarchive\fR |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 22 | and frees the memory allocated for it. |
Dieter Baron | 9e736f1 | 2003-10-03 08:33:09 +0000 | [diff] [blame] | 23 | If any files within were changed, those changes are written to disk |
| 24 | first. |
| 25 | If writing changes fails, |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 26 | \fBzip_close\fR() |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 27 | fails and |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 28 | \fIarchive\fR |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 29 | is left unchanged. |
Thomas Klausner | a10bd6c | 2008-07-25 11:54:24 +0200 | [diff] [blame] | 30 | If |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 31 | \fIarchive\fR |
Thomas Klausner | a10bd6c | 2008-07-25 11:54:24 +0200 | [diff] [blame] | 32 | contains no files, the file is completely removed (no empty archive is |
| 33 | written). |
Thomas Klausner | dd4cf74 | 2012-02-13 22:15:37 +0100 | [diff] [blame] | 34 | .PP |
| 35 | To close a zip file without saving changes, use |
| 36 | zip_discard(3). |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 37 | .SH "RETURN VALUES" |
Dieter Baron | 9e736f1 | 2003-10-03 08:33:09 +0000 | [diff] [blame] | 38 | Upon successful completion 0 is returned. |
Thomas Klausner | c31f08a | 2005-01-11 21:23:01 +0000 | [diff] [blame] | 39 | Otherwise, \-1 is returned and the error code in |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 40 | \fIarchive\fR |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 41 | is set to indicate the error. |
| 42 | .SH "ERRORS" |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 43 | \fBzip_close\fR() |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 44 | will fail if: |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 45 | .TP 19n |
| 46 | [\fRZIP_ER_EOF\fR] |
Thomas Klausner | e8b2694 | 2005-06-09 19:52:49 +0000 | [diff] [blame] | 47 | Unexpected end-of-file found while reading from a file. |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 48 | .TP 19n |
| 49 | [\fRZIP_ER_INTERNAL\fR] |
Thomas Klausner | e8b2694 | 2005-06-09 19:52:49 +0000 | [diff] [blame] | 50 | The callback function of an added or replaced file returned an |
| 51 | error but failed to report which. |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 52 | .TP 19n |
| 53 | [\fRZIP_ER_INVAL\fR] |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 54 | The |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 55 | \fIpath\fR |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 56 | argument is |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 57 | \fRNULL\fR. |
| 58 | .TP 19n |
| 59 | [\fRZIP_ER_MEMORY\fR] |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 60 | Required memory could not be allocated. |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 61 | .TP 19n |
| 62 | [\fRZIP_ER_NOZIP\fR] |
Thomas Klausner | c31f08a | 2005-01-11 21:23:01 +0000 | [diff] [blame] | 63 | File is not a zip archive. |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 64 | .TP 19n |
| 65 | [\fRZIP_ER_READ\fR] |
Thomas Klausner | c31f08a | 2005-01-11 21:23:01 +0000 | [diff] [blame] | 66 | A file read failed. |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 67 | .TP 19n |
| 68 | [\fRZIP_ER_RENAME\fR] |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 69 | A temporary file could not be renamed to its final name. |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 70 | .TP 19n |
| 71 | [\fRZIP_ER_SEEK\fR] |
Thomas Klausner | c31f08a | 2005-01-11 21:23:01 +0000 | [diff] [blame] | 72 | A file seek failed. |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 73 | .TP 19n |
| 74 | [\fRZIP_ER_TMPOPEN\fR] |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 75 | A temporary file could not be created. |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 76 | .TP 19n |
| 77 | [\fRZIP_ER_WRITE\fR] |
Thomas Klausner | c31f08a | 2005-01-11 21:23:01 +0000 | [diff] [blame] | 78 | A file write failed. |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 79 | .TP 19n |
| 80 | [\fRZIP_ER_ZLIB\fR] |
Thomas Klausner | e8b2694 | 2005-06-09 19:52:49 +0000 | [diff] [blame] | 81 | An error occurred while (de)compressing a stream with |
| 82 | zlib(3). |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 83 | .PD 0 |
| 84 | .PP |
Thomas Klausner | e8b2694 | 2005-06-09 19:52:49 +0000 | [diff] [blame] | 85 | Additionally, any errors returned by the callback function |
| 86 | for added or replaced files will be passed back. |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 87 | .PD |
Dieter Baron | 52bcc84 | 2003-10-03 07:59:27 +0000 | [diff] [blame] | 88 | .SH "SEE ALSO" |
Thomas Klausner | 3dd81d8 | 2005-06-09 19:01:53 +0000 | [diff] [blame] | 89 | libzip(3), |
Thomas Klausner | dd4cf74 | 2012-02-13 22:15:37 +0100 | [diff] [blame] | 90 | zip_discard(3), |
Thomas Klausner | c31f08a | 2005-01-11 21:23:01 +0000 | [diff] [blame] | 91 | zip_error_get(3), |
Thomas Klausner | 4b12334 | 2011-01-03 19:36:33 +0100 | [diff] [blame] | 92 | zip_fdopen(3), |
Thomas Klausner | c31f08a | 2005-01-11 21:23:01 +0000 | [diff] [blame] | 93 | zip_open(3), |
| 94 | zip_strerror(3) |
Thomas Klausner | 7533013 | 2005-06-17 12:59:06 +0000 | [diff] [blame] | 95 | .SH "AUTHORS" |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 96 | Dieter Baron <\fIdillo@nih.at\fR> |
Thomas Klausner | 7533013 | 2005-06-17 12:59:06 +0000 | [diff] [blame] | 97 | and |
Thomas Klausner | a5e9d4d | 2013-10-05 16:57:58 +0200 | [diff] [blame] | 98 | Thomas Klausner <\fItk@giga.or.at\fR> |