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