Imported Upstream version 1.1.3
[platform/upstream/libzip.git] / man / zip_source_file.man
1 .TH "ZIP_SOURCE_FILE" "3" "March 11, 2015" "NiH" "Library Functions Manual"
2 .nh
3 .if n .ad l
4 .SH "NAME"
5 \fBzip_source_file\fR
6 \- create data source from a file
7 .SH "LIBRARY"
8 libzip (-lzip)
9 .SH "SYNOPSIS"
10 \fIzip_source_t *\fR
11 .PD 0
12 .HP 4n
13 \fBzip_source_file\fR(\fIzip_t\ *archive\fR, \fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR);
14 .PD
15 .PP
16 \fIzip_source_t *\fR
17 .PD 0
18 .HP 4n
19 \fBzip_source_file_create\fR(\fIconst\ char\ *fname\fR, \fIzip_uint64_t\ start\fR, \fIzip_int64_t\ len\fR, \fIzip_error_t\ *error\fR);
20 .PD
21 .SH "DESCRIPTION"
22 The functions
23 \fBzip_source_file\fR()
24 and
25 \fBzip_source_file_create\fR()
26 create a zip source from a file.
27 They open
28 \fIfname\fR
29 and read
30 \fIlen\fR
31 bytes from offset
32 \fIstart\fR
33 from it.
34 If
35 \fIlen\fR
36 is 0 or \-1, the whole file (starting from
37 \fIstart\fR)
38 is used.
39 .PP
40 If the file supports seek, the source can be used to open a zip archive from.
41 .PP
42 The file is opened and read when the data from the source is used, usually by
43 \fBzip_close\fR()
44 or
45 \fBzip_open_from_source\fR().
46 .SH "RETURN VALUES"
47 Upon successful completion, the created source is returned.
48 Otherwise,
49 \fRNULL\fR
50 is returned and the error code in
51 \fIarchive\fR
52 or
53 \fIerror\fR
54 is set to indicate the error.
55 .SH "ERRORS"
56 \fBzip_source_file\fR()
57 and
58 \fBzip_source_file_create\fR()
59 fail if:
60 .TP 19n
61 [\fRZIP_ER_INVAL\fR]
62 \fIfname\fR,
63 \fIstart\fR,
64 or
65 \fIlen\fR
66 are invalid.
67 .TP 19n
68 [\fRZIP_ER_MEMORY\fR]
69 Required memory could not be allocated.
70 .TP 19n
71 [\fRZIP_ER_OPEN\fR]
72 Opening
73 \fIfname\fR
74 failed.
75 .SH "SEE ALSO"
76 libzip(3),
77 zip_add(3),
78 zip_replace(3),
79 zip_source(3)
80 .SH "AUTHORS"
81 Dieter Baron <\fIdillo@nih.at\fR>
82 and
83 Thomas Klausner <\fItk@giga.or.at\fR>