blob: d553754747728d36446286d49ad9f24f774c431c [file] [log] [blame]
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +02001.TH "ZIP_CLOSE" "3" "February 13, 2012" "NiH" "Library Functions Manual"
2.nh
3.if n .ad l
Dieter Baron52bcc842003-10-03 07:59:27 +00004.SH "NAME"
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +02005\fBzip_close\fR
6\- close zip archive
Dieter Baron52bcc842003-10-03 07:59:27 +00007.SH "LIBRARY"
Thomas Klausner201d1b22003-12-27 22:51:30 +00008libzip (-lzip)
Dieter Baron52bcc842003-10-03 07:59:27 +00009.SH "SYNOPSIS"
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020010\fB#include <zip.h>\fR
11.sp
12\fIint\fR
Thomas Klausner193739d2014-10-08 12:37:24 +020013.PD 0
14.HP 4n
15\fBzip_close\fR(\fIzip_t\ *archive\fR);
16.PD
Dieter Baron52bcc842003-10-03 07:59:27 +000017.SH "DESCRIPTION"
18The
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020019\fBzip_close\fR()
Dieter Baron52bcc842003-10-03 07:59:27 +000020function closes
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020021\fIarchive\fR
Dieter Baron52bcc842003-10-03 07:59:27 +000022and frees the memory allocated for it.
Dieter Baron9e736f12003-10-03 08:33:09 +000023If any files within were changed, those changes are written to disk
24first.
25If writing changes fails,
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020026\fBzip_close\fR()
Dieter Baron52bcc842003-10-03 07:59:27 +000027fails and
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020028\fIarchive\fR
Dieter Baron52bcc842003-10-03 07:59:27 +000029is left unchanged.
Thomas Klausnera10bd6c2008-07-25 11:54:24 +020030If
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020031\fIarchive\fR
Thomas Klausnera10bd6c2008-07-25 11:54:24 +020032contains no files, the file is completely removed (no empty archive is
33written).
Thomas Klausnerdd4cf742012-02-13 22:15:37 +010034.PP
35To close a zip file without saving changes, use
36zip_discard(3).
Dieter Baron52bcc842003-10-03 07:59:27 +000037.SH "RETURN VALUES"
Dieter Baron9e736f12003-10-03 08:33:09 +000038Upon successful completion 0 is returned.
Thomas Klausnerc31f08a2005-01-11 21:23:01 +000039Otherwise, \-1 is returned and the error code in
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020040\fIarchive\fR
Dieter Baron52bcc842003-10-03 07:59:27 +000041is set to indicate the error.
42.SH "ERRORS"
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020043\fBzip_close\fR()
Dieter Baron52bcc842003-10-03 07:59:27 +000044will fail if:
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020045.TP 19n
46[\fRZIP_ER_EOF\fR]
Thomas Klausnere8b26942005-06-09 19:52:49 +000047Unexpected end-of-file found while reading from a file.
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020048.TP 19n
49[\fRZIP_ER_INTERNAL\fR]
Thomas Klausnere8b26942005-06-09 19:52:49 +000050The callback function of an added or replaced file returned an
51error but failed to report which.
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020052.TP 19n
53[\fRZIP_ER_INVAL\fR]
Dieter Baron52bcc842003-10-03 07:59:27 +000054The
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020055\fIpath\fR
Dieter Baron52bcc842003-10-03 07:59:27 +000056argument is
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020057\fRNULL\fR.
58.TP 19n
59[\fRZIP_ER_MEMORY\fR]
Dieter Baron52bcc842003-10-03 07:59:27 +000060Required memory could not be allocated.
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020061.TP 19n
62[\fRZIP_ER_NOZIP\fR]
Thomas Klausnerc31f08a2005-01-11 21:23:01 +000063File is not a zip archive.
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020064.TP 19n
65[\fRZIP_ER_READ\fR]
Thomas Klausnerc31f08a2005-01-11 21:23:01 +000066A file read failed.
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020067.TP 19n
68[\fRZIP_ER_RENAME\fR]
Dieter Baron52bcc842003-10-03 07:59:27 +000069A temporary file could not be renamed to its final name.
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020070.TP 19n
71[\fRZIP_ER_SEEK\fR]
Thomas Klausnerc31f08a2005-01-11 21:23:01 +000072A file seek failed.
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020073.TP 19n
74[\fRZIP_ER_TMPOPEN\fR]
Dieter Baron52bcc842003-10-03 07:59:27 +000075A temporary file could not be created.
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020076.TP 19n
77[\fRZIP_ER_WRITE\fR]
Thomas Klausnerc31f08a2005-01-11 21:23:01 +000078A file write failed.
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020079.TP 19n
80[\fRZIP_ER_ZLIB\fR]
Thomas Klausnere8b26942005-06-09 19:52:49 +000081An error occurred while (de)compressing a stream with
82zlib(3).
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020083.PD 0
84.PP
Thomas Klausnere8b26942005-06-09 19:52:49 +000085Additionally, any errors returned by the callback function
86for added or replaced files will be passed back.
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020087.PD
Dieter Baron52bcc842003-10-03 07:59:27 +000088.SH "SEE ALSO"
Thomas Klausner3dd81d82005-06-09 19:01:53 +000089libzip(3),
Thomas Klausnerdd4cf742012-02-13 22:15:37 +010090zip_discard(3),
Thomas Klausnerc31f08a2005-01-11 21:23:01 +000091zip_error_get(3),
Thomas Klausner4b123342011-01-03 19:36:33 +010092zip_fdopen(3),
Thomas Klausnerc31f08a2005-01-11 21:23:01 +000093zip_open(3),
94zip_strerror(3)
Thomas Klausner75330132005-06-17 12:59:06 +000095.SH "AUTHORS"
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020096Dieter Baron <\fIdillo@nih.at\fR>
Thomas Klausner75330132005-06-17 12:59:06 +000097and
Thomas Klausnera5e9d4d2013-10-05 16:57:58 +020098Thomas Klausner <\fItk@giga.or.at\fR>