"Fossies" - the Fresh Open Source Software Archive

Member "libzip-1.5.2/man/zip_file_get_external_attributes.html" (12 Mar 2019, 9234 Bytes) of package /linux/misc/libzip-1.5.2.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) HTML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 <!DOCTYPE html>
    2 <html>
    3 <!-- This is an automatically generated file.  Do not edit.
    4    zip_file_get_external_attributes.mdoc -- get external attributes for file in zip
    5    Copyright (C) 2013-2017 Dieter Baron and Thomas Klausner
    6   
    7    This file is part of libzip, a library to manipulate ZIP files.
    8    The authors can be contacted at <libzip@nih.at>
    9   
   10    Redistribution and use in source and binary forms, with or without
   11    modification, are permitted provided that the following conditions
   12    are met:
   13    1. Redistributions of source code must retain the above copyright
   14       notice, this list of conditions and the following disclaimer.
   15    2. Redistributions in binary form must reproduce the above copyright
   16       notice, this list of conditions and the following disclaimer in
   17       the documentation and/or other materials provided with the
   18       distribution.
   19    3. The names of the authors may not be used to endorse or promote
   20       products derived from this software without specific prior
   21       written permission.
   22   
   23    THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
   24    OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   25    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   26    ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
   27    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   28    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
   29    GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   30    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
   31    IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
   32    OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
   33    IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   34    -->
   35 <head>
   36   <meta charset="utf-8"/>
   37   <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/>
   38   <title>ZIP_FILE_GET_EXTERNAL_ATTRIBUTES(3)</title>
   39 </head>
   40 <body>
   41 <table class="head">
   42   <tr>
   43     <td class="head-ltitle">ZIP_FILE_GET_EXTERNAL_ATTRIBUTES(3)</td>
   44     <td class="head-vol">Library Functions Manual</td>
   45     <td class="head-rtitle">ZIP_FILE_GET_EXTERNAL_ATTRIBUTES(3)</td>
   46   </tr>
   47 </table>
   48 <div class="manual-text">
   49 <section class="Sh">
   50 <h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
   51 <code class="Nm">zip_file_get_external_attributes</code> &#x2014;
   52 <div class="Nd">get external attributes for file in zip</div>
   53 </section>
   54 <section class="Sh">
   55 <h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1>
   56 libzip (-lzip)
   57 </section>
   58 <section class="Sh">
   59 <h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
   60 <code class="In">#include &lt;<a class="In">zip.h</a>&gt;</code>
   61 <p class="Pp"><var class="Ft">int</var>
   62   <br/>
   63   <code class="Fn">zip_file_get_external_attributes</code>(<var class="Fa" style="white-space: nowrap;">zip_t
   64     *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_uint64_t
   65     index</var>, <var class="Fa" style="white-space: nowrap;">zip_flags_t
   66     flags</var>, <var class="Fa" style="white-space: nowrap;">zip_uint8_t
   67     *opsys</var>, <var class="Fa" style="white-space: nowrap;">zip_uint32_t
   68     *attributes</var>);</p>
   69 </section>
   70 <section class="Sh">
   71 <h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
   72 The <code class="Fn">zip_file_get_external_attributes</code>() function returns
   73   the operating system and external attributes for the file at position
   74   <var class="Ar">index</var> in the zip archive. The external attributes
   75   usually contain the operating system-specific file permissions. If
   76   <var class="Ar">flags</var> is set to
   77   <code class="Dv">ZIP_FL_UNCHANGED</code>, the original unchanged values are
   78   returned. If <var class="Ar">opsys</var> or <var class="Ar">attributes</var>
   79   are <code class="Dv">NULL</code>, they are not filled in.
   80 <p class="Pp">The following operating systems are defined by the zip
   81     specification:</p>
   82 <ul class="Bl-item Bd-indent Bl-compact">
   83   <li><a class="permalink" href="#ZIP_OPSYS_ACORN_RISC"><code class="Dv" id="ZIP_OPSYS_ACORN_RISC">ZIP_OPSYS_ACORN_RISC</code></a></li>
   84   <li><a class="permalink" href="#ZIP_OPSYS_ALTERNATE_MVS"><code class="Dv" id="ZIP_OPSYS_ALTERNATE_MVS">ZIP_OPSYS_ALTERNATE_MVS</code></a></li>
   85   <li><a class="permalink" href="#ZIP_OPSYS_AMIGA"><code class="Dv" id="ZIP_OPSYS_AMIGA">ZIP_OPSYS_AMIGA</code></a></li>
   86   <li><a class="permalink" href="#ZIP_OPSYS_ATARI_ST"><code class="Dv" id="ZIP_OPSYS_ATARI_ST">ZIP_OPSYS_ATARI_ST</code></a></li>
   87   <li><a class="permalink" href="#ZIP_OPSYS_BEOS"><code class="Dv" id="ZIP_OPSYS_BEOS">ZIP_OPSYS_BEOS</code></a></li>
   88   <li><a class="permalink" href="#ZIP_OPSYS_CPM"><code class="Dv" id="ZIP_OPSYS_CPM">ZIP_OPSYS_CPM</code></a></li>
   89   <li><a class="permalink" href="#ZIP_OPSYS_DOS"><code class="Dv" id="ZIP_OPSYS_DOS">ZIP_OPSYS_DOS</code></a></li>
   90   <li><a class="permalink" href="#ZIP_OPSYS_MACINTOSH"><code class="Dv" id="ZIP_OPSYS_MACINTOSH">ZIP_OPSYS_MACINTOSH</code></a></li>
   91   <li><a class="permalink" href="#ZIP_OPSYS_MVS"><code class="Dv" id="ZIP_OPSYS_MVS">ZIP_OPSYS_MVS</code></a></li>
   92   <li><a class="permalink" href="#ZIP_OPSYS_OPENVMS"><code class="Dv" id="ZIP_OPSYS_OPENVMS">ZIP_OPSYS_OPENVMS</code></a></li>
   93   <li><a class="permalink" href="#ZIP_OPSYS_OS_2"><code class="Dv" id="ZIP_OPSYS_OS_2">ZIP_OPSYS_OS_2</code></a></li>
   94   <li><a class="permalink" href="#ZIP_OPSYS_OS_400"><code class="Dv" id="ZIP_OPSYS_OS_400">ZIP_OPSYS_OS_400</code></a></li>
   95   <li><a class="permalink" href="#ZIP_OPSYS_OS_X"><code class="Dv" id="ZIP_OPSYS_OS_X">ZIP_OPSYS_OS_X</code></a></li>
   96   <li><a class="permalink" href="#ZIP_OPSYS_TANDEM"><code class="Dv" id="ZIP_OPSYS_TANDEM">ZIP_OPSYS_TANDEM</code></a></li>
   97   <li><a class="permalink" href="#ZIP_OPSYS_UNIX"><code class="Dv" id="ZIP_OPSYS_UNIX">ZIP_OPSYS_UNIX</code></a></li>
   98   <li><a class="permalink" href="#ZIP_OPSYS_VFAT"><code class="Dv" id="ZIP_OPSYS_VFAT">ZIP_OPSYS_VFAT</code></a></li>
   99   <li><a class="permalink" href="#ZIP_OPSYS_VM_CMS"><code class="Dv" id="ZIP_OPSYS_VM_CMS">ZIP_OPSYS_VM_CMS</code></a></li>
  100   <li><a class="permalink" href="#ZIP_OPSYS_VSE"><code class="Dv" id="ZIP_OPSYS_VSE">ZIP_OPSYS_VSE</code></a></li>
  101   <li><a class="permalink" href="#ZIP_OPSYS_WINDOWS_NTFS"><code class="Dv" id="ZIP_OPSYS_WINDOWS_NTFS">ZIP_OPSYS_WINDOWS_NTFS</code></a>
  102       (uncommon, use <code class="Dv">ZIP_OPSYS_DOS</code> instead)</li>
  103   <li><a class="permalink" href="#ZIP_OPSYS_Z_SYSTEM"><code class="Dv" id="ZIP_OPSYS_Z_SYSTEM">ZIP_OPSYS_Z_SYSTEM</code></a></li>
  104 </ul>
  105 <p class="Pp">The defines above follow the PKWARE Inc. Appnote; please note that
  106     the InfoZIP Appnote has a slightly different mapping.</p>
  107 </section>
  108 <section class="Sh">
  109 <h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
  110   VALUES</a></h1>
  111 Upon successful completion, 0 is returned. In case of an error,
  112   <code class="Dv">-1</code> is returned and the error code in
  113   <var class="Ar">archive</var> is set to indicate the error.
  114 </section>
  115 <section class="Sh">
  116 <h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1>
  117 The following code can be used to expand <var class="Ar">attributes</var> if the
  118   operating system is <code class="Dv">ZIP_OPSYS_DOS</code>.
  119 <div class="Bd Pp">
  120 <pre>
  121 #include &lt;sys/stat.h&gt;
  122 
  123 #define FA_RDONLY       0x01            // FILE_ATTRIBUTE_READONLY
  124 #define FA_DIREC        0x10            // FILE_ATTRIBUTE_DIRECTORY
  125 
  126 static mode_t
  127 _zip_dos_attr2mode(zip_uint32_t attr)
  128 {
  129    mode_t m = S_IRUSR | S_IRGRP | S_IROTH;
  130    if (0 == (attr &amp; FA_RDONLY))
  131       m |= S_IWUSR | S_IWGRP | S_IWOTH;
  132 
  133    if (attr &amp; FA_DIREC)
  134       m = (S_IFDIR | (m &amp; ~S_IFMT)) | S_IXUSR | S_IXGRP | S_IXOTH;
  135 
  136    return m;
  137 }
  138 </pre>
  139 </div>
  140 </section>
  141 <section class="Sh">
  142 <h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
  143 <code class="Fn">zip_file_get_external_attributes</code>() fails if:
  144 <dl class="Bl-tag">
  145   <dt>[<a class="permalink" href="#ZIP_ER_INVAL"><code class="Er" id="ZIP_ER_INVAL">ZIP_ER_INVAL</code></a>]</dt>
  146   <dd><var class="Ar">index</var> is not a valid file index in
  147       <var class="Ar">archive</var>.</dd>
  148 </dl>
  149 </section>
  150 <section class="Sh">
  151 <h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
  152   ALSO</a></h1>
  153 <a class="Xr" href="libzip.html">libzip(3)</a>,
  154   <a class="Xr" href="zip_file_set_external_attributes.html">zip_file_set_external_attributes(3)</a>
  155 </section>
  156 <section class="Sh">
  157 <h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
  158 <code class="Fn">zip_file_get_external_attributes</code>() was added in libzip
  159   0.11.2.
  160 </section>
  161 <section class="Sh">
  162 <h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
  163 <span class="An">Dieter Baron</span>
  164   &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
  165   <span class="An">Thomas Klausner</span>
  166   &lt;<a class="Mt" href="mailto:tk@giga.or.at">tk@giga.or.at</a>&gt;
  167 </section>
  168 </div>
  169 <table class="foot">
  170   <tr>
  171     <td class="foot-date">December 18, 2017</td>
  172     <td class="foot-os">NetBSD 8.99.35</td>
  173   </tr>
  174 </table>
  175 </body>
  176 </html>