Imported Upstream version 1.1.1
[platform/upstream/libzip.git] / man / ziptool.man
1 .TH "ZIPTOOL" "1" "January 19, 2016" "NiH" "General Commands Manual"
2 .nh
3 .if n .ad l
4 .SH "NAME"
5 \fBziptool\fR
6 \- modify zip archives
7 .SH "SYNOPSIS"
8 .HP 8n
9 \fBziptool\fR
10 [\fB\-cegHhmnrst\fR]
11 \fIzip-archive\fR
12 \fBcommand\fR\ [\fIcommand-args\ ...\fR]
13 [\fBcommand\fR\ [\fIcommand-args\ ...\fR]\ ...]
14 .SH "DESCRIPTION"
15 \fBziptool\fR
16 modifies the zip archive
17 \fIzip-archive\fR
18 according to the
19 \fIcommands\fR
20 given.
21 .PP
22 Supported options:
23 .TP 5n
24 \fB\-c\fR
25 Check zip archive consistency when opening it.
26 .TP 5n
27 \fB\-e\fR
28 Error if archive already exists (only useful with
29 \fB\-n\fR).
30 .TP 5n
31 \fB\-g\fR
32 Guess file name encoding (for
33 \fBstat\fR
34 command).
35 .TP 5n
36 \fB\-H\fR
37 Write files with
38 \(Lqholes\(Rq
39 compactly.
40 In other words, when the modified zip archive contains long runs of zeroes,
41 write a basic run-length encoded block instead.
42 \fINote\fR:
43 This command is for internal testing of
44 libzip(3)
45 and will usually create invalid zip archives.
46 .TP 5n
47 \fB\-h\fR
48 Display help.
49 .TP 5n
50 \fB\-m\fR
51 Read archive into memory, and modify there; write out at end.
52 \fINote\fR:
53 This command is for internal testing of
54 libzip(3).
55 .TP 5n
56 \fB\-n\fR
57 Create archive if it doesn't exist.
58 See also
59 \fB\-e\fR.
60 .TP 5n
61 \fB\-r\fR
62 Print raw file name encoding without translation (for
63 \fBstat\fR
64 command).
65 .TP 5n
66 \fB\-s\fR
67 Follow file name convention strictly (for
68 \fBstat\fR
69 command).
70 .TP 5n
71 \fB\-t\fR
72 Disregard current file contents, if any.
73 \fINote\fR:
74 use this with care, it deletes all existing file contents when
75 you modify the archive.
76 .SS "Commands"
77 For all commands below, the index is zero-based.
78 In other words, the first entry in the zip archive has index 0.
79 .PP
80 Supported commands and arguments are:
81 .TP 12n
82 \fBadd\fR \fIname content\fR
83 Add file called
84 \fIname\fR
85 using the string
86 \fIcontent\fR
87 from the command line as data.
88 .TP 12n
89 \fBadd_dir\fR \fIname\fR
90 Add directory
91 \fIname\fR.
92 .TP 12n
93 \fBadd_file\fR \fIname file_to_add offset len\fR
94 Add file
95 \fIname\fR
96 to archive, using
97 \fIlen\fR
98 bytes from the file
99 \fIfile_to_add\fR
100 as input data, starting at
101 \fIoffset\fR.
102 .TP 12n
103 \fBadd_from_zip\fR \fIname archivename index offset len\fR
104 Add file called
105 \fIname\fR
106 to archive using data from another zip archive
107 \fIarchivename\fR
108 using the entry with index
109 \fIindex\fR
110 and reading
111 \fIlen\fR
112 bytes from
113 \fIoffset\fR.
114 .TP 12n
115 \fBadd_nul\fR \fIname length\fR
116 Add a file
117 \fIname\fR
118 consisting of
119 \fIlength\fR
120 NUL bytes.
121 (Mostly useful for testing.)
122 .TP 12n
123 \fBcat\fR \fIindex\fR
124 Output file contents for entry
125 \fIindex\fR
126 to stdout.
127 .TP 12n
128 \fBcount_extra\fR \fIindex flags\fR
129 Print the number of extra fields for archive entry
130 \fIindex\fR
131 using
132 \fIflags\fR.
133 .TP 12n
134 \fBcount_extra_by_id\fR \fIindex extra_id flags\fR
135 Print number of extra fields of type
136 \fIextra_id\fR
137 for archive entry
138 \fIindex\fR
139 using
140 \fIflags\fR.
141 .TP 12n
142 \fBdelete\fR \fIindex\fR
143 Remove entry at
144 \fIindex\fR
145 from zip archive.
146 .TP 12n
147 \fBdelete_extra\fR \fIindex extra_idx flags\fR
148 Remove extra field number
149 \fIextra_idx\fR
150 from archive entry
151 \fIindex\fR
152 using
153 \fIflags\fR.
154 .TP 12n
155 \fBdelete_extra_by_id\fR \fIindex extra_id extra_index flags\fR
156 Remove extra field number
157 \fIextra_index\fR
158 of type
159 \fIextra_id\fR
160 from archive entry
161 \fIindex\fR
162 using
163 \fIflags\fR.
164 .TP 12n
165 \fBget_archive_comment\fR
166 Print archive comment.
167 .TP 12n
168 \fBget_extra\fR \fIindex extra_index flags\fR
169 Print extra field
170 \fIextra_index\fR
171 for archive entry
172 \fIindex\fR
173 using
174 \fIflags\fR.
175 .TP 12n
176 \fBget_extra_by_id\fR \fIindex extra_id extra_index flags\fR
177 Print extra field
178 \fIextra_index\fR
179 of type
180 \fIextra_id\fR
181 for archive entry
182 \fIindex\fR
183 using
184 \fIflags\fR.
185 .TP 12n
186 \fBget_file_comment\fR \fIindex\fR
187 Get file comment for archive entry
188 \fIindex\fR.
189 .TP 12n
190 \fBget_num_entries\fR \fIflags\fR
191 Print number of entries in archive using
192 \fIflags\fR.
193 .TP 12n
194 \fBname_locate\fR \fIname flags\fR
195 Find entry in archive with the filename
196 \fIname\fR
197 using
198 \fIflags\fR
199 and print its index.
200 .TP 12n
201 \fBrename\fR \fIindex name\fR
202 Rename archive entry
203 \fIindex\fR
204 to
205 \fIname\fR.
206 .TP 12n
207 \fBreplace_file_contents\fR \fIindex data\fR
208 Replace file contents for archive entry
209 \fIindex\fR
210 with the string
211 \fIdata\fR.
212 .TP 12n
213 \fBset_archive_comment\fR \fIcomment\fR
214 Set archive comment to
215 \fIcomment\fR.
216 .TP 12n
217 \fBset_extra\fR \fIindex extra_id extra_index flags value\fR
218 Set extra field number
219 \fIextra_index\fR
220 of type
221 \fIextra_id\fR
222 for archive entry
223 \fIindex\fR
224 using
225 \fIflags\fR
226 to
227 \fIvalue\fR.
228 .TP 12n
229 \fBset_file_comment\fR \fIindex comment\fR
230 Set file comment for archive entry
231 \fIindex\fR
232 to string
233 \fIcomment\fR.
234 .TP 12n
235 \fBset_file_compression\fR \fIindex method compression_flags\fR
236 Set file compression method for archive entry
237 \fIindex\fR
238 to
239 \fImethod\fR
240 using
241 \fIcompression_flags\fR.
242 \fINote\fR:
243 Currently,
244 \fIcompression_flags\fR
245 are ignored.
246 .TP 12n
247 \fBset_file_mtime\fR \fIindex timestamp\fR
248 Set file modification time for archive entry
249 \fIindex\fR
250 to UNIX mtime
251 \fItimestamp\fR.
252 .TP 12n
253 \fBset_file_mtime_all\fR \fItimestamp\fR
254 Set file modification time for all archive entries to UNIX mtime
255 \fItimestamp\fR.
256 .TP 12n
257 \fBset_password\fR \fIpassword\fR
258 Set default password for encryption/decryption to
259 \fIpassword\fR.
260 .TP 12n
261 \fBstat\fR \fIindex\fR
262 Print information about archive entry
263 \fIindex\fR.
264 .TP 12n
265 \fBunchange_all\fR
266 Revert all changes up to that point.
267 Mostly useful for testing.
268 .TP 12n
269 \fBzin_close\fR \fIindex\fR
270 Close input zip_source
271 \fIindex\fR.
272 For internal tests only.
273 .SS "Flags"
274 Some commands take flag arguments.
275 Supported flags are:
276 .RS 6n
277 .PD 0
278 .TP 5n
279 \fIC\fR
280 \fRZIP_FL_NOCASE\fR
281 .TP 5n
282 \fIc\fR
283 \fRZIP_FL_CENTRAL\fR
284 .TP 5n
285 \fId\fR
286 \fRZIP_FL_NODIR\fR
287 .TP 5n
288 \fIl\fR
289 \fRZIP_FL_LOCAL\fR
290 .TP 5n
291 \fIu\fR
292 \fRZIP_FL_UNCHANGED\fR
293 .RE
294 .PD
295 .SS "Compression Methods"
296 Some commands take compression method arguments.
297 Supported methods are:
298 .RS 6n
299 .PD 0
300 .TP 4n
301 \fB\(bu\fR
302 \fRdefault\fR
303 .TP 4n
304 \fB\(bu\fR
305 \fRdeflate\fR
306 .TP 4n
307 \fB\(bu\fR
308 \fRstore\fR
309 .RE
310 .PD
311 .SH "EXIT STATUS"
312 .br
313 The \fBziptool\fR utility exits\~0 on success, and\~>0 if an error occurs.
314 .SH "EXAMPLES"
315 Add a file called
316 \fIteststring.txt\fR
317 to the zip archive
318 \fItestbuffer.zip\fR
319 with data
320 \(LqThis is a test.\en\(Rq
321 where
322 \(Lq\en\(Rq
323 is replaced with a newline character:
324 .nf
325 .sp
326 .RS 6n
327 ziptool testbuffer.zip add teststring.txt \\"This is a test.\en\\"
328 .RE
329 .fi
330 .PP
331 Delete the first file from the zip archive
332 \fItestfile.zip\fR:
333 .nf
334 .sp
335 .RS 6n
336 ziptool testfile.zip delete 0
337 .RE
338 .fi
339 .SH "SEE ALSO"
340 zipcmp(1),
341 zipmerge(1),
342 libzip(3)
343 .SH "AUTHORS"
344 Dieter Baron <\fIdillo@nih.at\fR>
345 and
346 Thomas Klausner <\fItk@giga.or.at\fR>