"Fossies" - the Fresh Open Source Software Archive

Member "libzip-1.5.2/man/zip_file_get_external_attributes.mdoc" (12 Mar 2019, 4421 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) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "zip_file_get_external_attributes.mdoc": 1.3.2_vs_1.4.0.

    1 .\" zip_file_get_external_attributes.mdoc -- get external attributes for file in zip
    2 .\" Copyright (C) 2013-2017 Dieter Baron and Thomas Klausner
    3 .\"
    4 .\" This file is part of libzip, a library to manipulate ZIP files.
    5 .\" The authors can be contacted at <libzip@nih.at>
    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 .\"
   32 .Dd December 18, 2017
   33 .Dt ZIP_FILE_GET_EXTERNAL_ATTRIBUTES 3
   34 .Os
   35 .Sh NAME
   36 .Nm zip_file_get_external_attributes
   37 .Nd get external attributes for file in zip
   38 .Sh LIBRARY
   39 libzip (-lzip)
   40 .Sh SYNOPSIS
   41 .In zip.h
   42 .Ft int
   43 .Fn zip_file_get_external_attributes "zip_t *archive" "zip_uint64_t index" "zip_flags_t flags" "zip_uint8_t *opsys" "zip_uint32_t *attributes"
   44 .Sh DESCRIPTION
   45 The
   46 .Fn zip_file_get_external_attributes
   47 function returns the operating system and external attributes for the
   48 file at position
   49 .Ar index
   50 in the zip archive.
   51 The external attributes usually contain the operating system-specific
   52 file permissions.
   53 If
   54 .Ar flags
   55 is set to
   56 .Dv ZIP_FL_UNCHANGED ,
   57 the original unchanged values are returned.
   58 If
   59 .Ar opsys
   60 or
   61 .Ar attributes
   62 are
   63 .Dv NULL ,
   64 they are not filled in.
   65 .Pp
   66 The following operating systems are defined by the zip specification:
   67 .Bl -item -compact -offset indent
   68 .It
   69 .Dv ZIP_OPSYS_ACORN_RISC
   70 .It
   71 .Dv ZIP_OPSYS_ALTERNATE_MVS
   72 .It
   73 .Dv ZIP_OPSYS_AMIGA
   74 .It
   75 .Dv ZIP_OPSYS_ATARI_ST
   76 .It
   77 .Dv ZIP_OPSYS_BEOS
   78 .It
   79 .Dv ZIP_OPSYS_CPM
   80 .It
   81 .Dv ZIP_OPSYS_DOS
   82 .It
   83 .Dv ZIP_OPSYS_MACINTOSH
   84 .It
   85 .Dv ZIP_OPSYS_MVS
   86 .It
   87 .Dv ZIP_OPSYS_OPENVMS
   88 .It
   89 .Dv ZIP_OPSYS_OS_2
   90 .It
   91 .Dv ZIP_OPSYS_OS_400
   92 .It
   93 .Dv ZIP_OPSYS_OS_X
   94 .It
   95 .Dv ZIP_OPSYS_TANDEM
   96 .It
   97 .Dv ZIP_OPSYS_UNIX
   98 .It
   99 .Dv ZIP_OPSYS_VFAT
  100 .It
  101 .Dv ZIP_OPSYS_VM_CMS
  102 .It
  103 .Dv ZIP_OPSYS_VSE
  104 .It
  105 .Dv ZIP_OPSYS_WINDOWS_NTFS
  106 (uncommon, use
  107 .Dv ZIP_OPSYS_DOS
  108 instead)
  109 .It
  110 .Dv ZIP_OPSYS_Z_SYSTEM
  111 .El
  112 .Pp
  113 The defines above follow the PKWARE Inc. Appnote; please note that
  114 the InfoZIP Appnote has a slightly different mapping.
  115 .Sh RETURN VALUES
  116 Upon successful completion, 0 is returned.
  117 In case of an error,
  118 .Dv \-1
  119 is returned and the error code in
  120 .Ar archive
  121 is set to indicate the error.
  122 .Sh EXAMPLES
  123 The following code can be used to expand
  124 .Ar attributes
  125 if the operating system is
  126 .Dv ZIP_OPSYS_DOS .
  127 .Bd -literal
  128 #include <sys/stat.h>
  129 
  130 #define FA_RDONLY       0x01            // FILE_ATTRIBUTE_READONLY
  131 #define FA_DIREC        0x10            // FILE_ATTRIBUTE_DIRECTORY
  132 
  133 static mode_t
  134 _zip_dos_attr2mode(zip_uint32_t attr)
  135 {
  136    mode_t m = S_IRUSR | S_IRGRP | S_IROTH;
  137    if (0 == (attr & FA_RDONLY))
  138       m |= S_IWUSR | S_IWGRP | S_IWOTH;
  139 
  140    if (attr & FA_DIREC)
  141       m = (S_IFDIR | (m & ~S_IFMT)) | S_IXUSR | S_IXGRP | S_IXOTH;
  142 
  143    return m;
  144 }
  145 .Ed
  146 .Sh ERRORS
  147 .Fn zip_file_get_external_attributes
  148 fails if:
  149 .Bl -tag -width Er
  150 .It Bq Er ZIP_ER_INVAL
  151 .Ar index
  152 is not a valid file index in
  153 .Ar archive .
  154 .El
  155 .Sh SEE ALSO
  156 .Xr libzip 3 ,
  157 .Xr zip_file_set_external_attributes 3
  158 .Sh HISTORY
  159 .Fn zip_file_get_external_attributes
  160 was added in libzip 0.11.2.
  161 .Sh AUTHORS
  162 .An -nosplit
  163 .An Dieter Baron Aq Mt dillo@nih.at
  164 and
  165 .An Thomas Klausner Aq Mt tk@giga.or.at