Imported Upstream version 1.1.3
[platform/upstream/libzip.git] / man / zip_file_set_comment.man
1 .TH "ZIP_FILE_SET_COMMENT" "3" "September 19, 2013" "NiH" "Library Functions Manual"
2 .nh
3 .if n .ad l
4 .SH "NAME"
5 \fBzip_file_set_comment\fR
6 \- set comment for file in zip
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_set_file_comment\fR(\fIzip_t\ *archive\fR, \fIzip_uint64_t\ index\fR, \fIconst\ char\ *comment\fR, \fIzip_uint16_t\ len\fR, \fIzip_flags_t\ flags\fR);
16 .PD
17 .SH "DESCRIPTION"
18 The
19 \fBzip_file_set_comment\fR()
20 function sets the comment for the file at position
21 \fIindex\fR
22 in the zip archive to
23 \fIcomment\fR
24 of length
25 \fIlen\fR.
26 If
27 \fIcomment\fR
28 is
29 \fRNULL\fR
30 and
31 \fIlen\fR
32 is 0, the file comment will be removed.
33 The
34 \fIflags\fR
35 argument can be any of:
36 .TP 22n
37 \fRZIP_FL_ENC_GUESS\fR
38 Guess encoding of
39 \fIcomment\fR
40 (default).
41 .TP 22n
42 \fRZIP_FL_ENC_UTF_8\fR
43 Interpret
44 \fIcomment\fR
45 as UTF-8.
46 .TP 22n
47 \fRZIP_FL_ENC_CP437\fR
48 Interpret
49 \fIcomment\fR
50 as code page 437 (CP-437).
51 .SH "RETURN VALUES"
52 Upon successful completion 0 is returned.
53 Otherwise, \-1 is returned and the error information in
54 \fIarchive\fR
55 is set to indicate the error.
56 .SH "ERRORS"
57 \fBzip_file_set_comment\fR()
58 fails if:
59 .TP 19n
60 [\fRZIP_ER_INVAL\fR]
61 \fIindex\fR
62 is not a valid file index in
63 \fIarchive\fR,
64 or
65 \fIlen\fR
66 is less than 0 or longer than the maximum comment length in a zip file
67 (65535), or
68 \fIcomment\fR
69 is not a valid UTF-8 encoded string.
70 .TP 19n
71 [\fRZIP_ER_MEMORY\fR]
72 Required memory could not be allocated.
73 .TP 19n
74 [\fRZIP_ER_RDONLY\fR]
75 The
76 \fIarchive\fR
77 was opened in read-only mode.
78 .SH "SEE ALSO"
79 libzip(3),
80 zip_file_get_comment(3),
81 zip_get_archive_comment(3),
82 zip_set_archive_comment(3)
83 .SH "AUTHORS"
84 Dieter Baron <\fIdillo@nih.at\fR>
85 and
86 Thomas Klausner <\fItk@giga.or.at\fR>