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