Thomas Klausner | 7edc9e2 | 2004-11-18 16:48:08 +0000 | [diff] [blame] | 1 | .\" zip_source_file.mdoc -- create data source from a file |
Thomas Klausner | 86a346b | 2014-08-02 12:10:27 +0200 | [diff] [blame] | 2 | .\" Copyright (C) 2004-2014 Dieter Baron and Thomas Klausner |
Thomas Klausner | 7edc9e2 | 2004-11-18 16:48:08 +0000 | [diff] [blame] | 3 | .\" |
| 4 | .\" This file is part of libzip, a library to manipulate ZIP archives. |
Dieter Baron | b86c433 | 2007-11-07 14:35:13 +0100 | [diff] [blame] | 5 | .\" The authors can be contacted at <libzip@nih.at> |
Thomas Klausner | 7edc9e2 | 2004-11-18 16:48:08 +0000 | [diff] [blame] | 6 | .\" |
| 7 | .\" Redistribution and use in source and binary forms, with or without |
| 8 | .\" modification, are permitted provided that the following conditions |
| 9 | .\" are met: |
| 10 | .\" 1. Redistributions of source code must retain the above copyright |
| 11 | .\" notice, this list of conditions and the following disclaimer. |
| 12 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| 13 | .\" notice, this list of conditions and the following disclaimer in |
| 14 | .\" the documentation and/or other materials provided with the |
| 15 | .\" distribution. |
| 16 | .\" 3. The names of the authors may not be used to endorse or promote |
| 17 | .\" products derived from this software without specific prior |
| 18 | .\" written permission. |
| 19 | .\" |
| 20 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS |
| 21 | .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 22 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY |
| 24 | .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
| 26 | .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 27 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
| 28 | .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 29 | .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 30 | .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | .\" |
Thomas Klausner | 86a346b | 2014-08-02 12:10:27 +0200 | [diff] [blame] | 32 | .Dd August 2, 2014 |
Thomas Klausner | 7edc9e2 | 2004-11-18 16:48:08 +0000 | [diff] [blame] | 33 | .Dt ZIP_SOURCE_FILE 3 |
| 34 | .Os |
| 35 | .Sh NAME |
| 36 | .Nm zip_source_file |
| 37 | .Nd create data source from a file |
| 38 | .Sh LIBRARY |
| 39 | libzip (-lzip) |
| 40 | .Sh SYNOPSIS |
Dieter Baron | 1d9dfeb | 2014-09-28 23:02:54 +0200 | [diff] [blame] | 41 | .Ft zip_source_t * |
| 42 | .Fn zip_source_file "zip_t *archive" "const char *fname" \ |
Dieter Baron | c65abed | 2008-08-01 17:04:17 +0200 | [diff] [blame] | 43 | "zip_uint64_t start" "zip_int64_t len" |
Thomas Klausner | 7edc9e2 | 2004-11-18 16:48:08 +0000 | [diff] [blame] | 44 | .Sh DESCRIPTION |
| 45 | The function |
| 46 | .Fn zip_source_file |
| 47 | creates a zip source from a file. |
Thomas Klausner | c31082f | 2005-07-15 14:11:16 +0000 | [diff] [blame] | 48 | .Fn zip_source_file |
Thomas Klausner | 7edc9e2 | 2004-11-18 16:48:08 +0000 | [diff] [blame] | 49 | opens |
| 50 | .Ar fname |
| 51 | and reads |
| 52 | .Ar len |
| 53 | bytes from offset |
Thomas Klausner | e9f5c29 | 2004-12-22 16:37:48 +0000 | [diff] [blame] | 54 | .Ar start |
Thomas Klausner | 7edc9e2 | 2004-11-18 16:48:08 +0000 | [diff] [blame] | 55 | from it. |
| 56 | If |
| 57 | .Ar len |
| 58 | is 0 or \-1, the whole file (starting from |
| 59 | .Ar start ) |
| 60 | is used. |
Dieter Baron | c65abed | 2008-08-01 17:04:17 +0200 | [diff] [blame] | 61 | .Pp |
| 62 | The fie is opened and read when the data from the source is used, usually by |
| 63 | .Fn zip_close . |
Thomas Klausner | 7edc9e2 | 2004-11-18 16:48:08 +0000 | [diff] [blame] | 64 | .Sh RETURN VALUES |
| 65 | Upon successful completion, the created source is returned. |
| 66 | Otherwise, |
| 67 | .Dv NULL |
| 68 | is returned and the error code in |
| 69 | .Ar archive |
| 70 | is set to indicate the error. |
| 71 | .Sh ERRORS |
| 72 | .Fn zip_source_file |
| 73 | fails if: |
| 74 | .Bl -tag -width Er |
| 75 | .It Bq Er ZIP_ER_INVAL |
| 76 | .Ar fname , |
| 77 | .Ar start , |
| 78 | or |
| 79 | .Ar len |
| 80 | are invalid. |
| 81 | .It Bq Er ZIP_ER_MEMORY |
| 82 | Required memory could not be allocated. |
| 83 | .It Bq Er ZIP_ER_OPEN |
| 84 | Opening |
| 85 | .Ar fname |
| 86 | failed. |
| 87 | .El |
| 88 | .Sh SEE ALSO |
Thomas Klausner | bec1cfe | 2005-06-09 18:50:27 +0000 | [diff] [blame] | 89 | .Xr libzip 3 , |
Thomas Klausner | 7edc9e2 | 2004-11-18 16:48:08 +0000 | [diff] [blame] | 90 | .Xr zip_add 3 , |
| 91 | .Xr zip_replace 3 , |
Thomas Klausner | 86a346b | 2014-08-02 12:10:27 +0200 | [diff] [blame] | 92 | .Xr zip_source 3 |
Thomas Klausner | a456cf5 | 2005-06-09 21:13:13 +0000 | [diff] [blame] | 93 | .Sh AUTHORS |
| 94 | .An -nosplit |
Thomas Klausner | 0acbab4 | 2013-07-28 23:29:08 +0200 | [diff] [blame] | 95 | .An Dieter Baron Aq Mt dillo@nih.at |
Thomas Klausner | 39b5f9e | 2005-06-09 21:14:54 +0000 | [diff] [blame] | 96 | and |
Thomas Klausner | 0acbab4 | 2013-07-28 23:29:08 +0200 | [diff] [blame] | 97 | .An Thomas Klausner Aq Mt tk@giga.or.at |