@papyrus-sdk/engine-native 0.2.22-beta.2 → 0.2.22-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -0
- package/android/src/main/cpp/CMakeLists.txt +137 -0
- package/android/src/main/cpp/PapyrusComicArchiveJni.cpp +68 -0
- package/android/src/main/cpp/PapyrusComicArchiveTest.cpp +55 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusComicArchiveNative.java +14 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentView.java +353 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentViewManager.java +32 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusComicPageLayout.java +17 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusNativeEngineModule.java +298 -34
- package/android/src/main/java/com/papyrus/engine/PapyrusNativeTextModel.java +195 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusPackage.java +3 -1
- package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerView.java +24 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusRenderMath.java +9 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentView.java +439 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentViewManager.java +43 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusTextStore.java +43 -0
- package/dist/index.d.mts +439 -3
- package/dist/index.d.ts +439 -3
- package/dist/index.js +412 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +404 -3
- package/dist/index.mjs.map +1 -1
- package/ios/PapyrusComicDocumentView.h +21 -0
- package/ios/PapyrusComicDocumentView.m +374 -0
- package/ios/PapyrusComicDocumentViewManager.m +23 -0
- package/ios/PapyrusEngineStore.m +4 -0
- package/ios/PapyrusNativeEngine.m +664 -0
- package/ios/PapyrusNativeEngine.podspec +26 -1
- package/ios/PapyrusPageRotationRegistry.h +29 -0
- package/ios/PapyrusPageRotationRegistry.m +179 -0
- package/ios/PapyrusPageView.m +38 -11
- package/ios/PapyrusPdfDocumentView.h +2 -0
- package/ios/PapyrusPdfDocumentView.m +116 -9
- package/ios/PapyrusPdfDocumentViewManager.m +2 -0
- package/ios/PapyrusPdfPageTheme.h +15 -0
- package/ios/PapyrusPdfPageTheme.m +218 -0
- package/ios/PapyrusTextDocumentView.h +27 -0
- package/ios/PapyrusTextDocumentView.m +300 -0
- package/ios/PapyrusTextDocumentViewManager.m +29 -0
- package/ios/PapyrusTextStore.h +13 -0
- package/ios/PapyrusTextStore.m +73 -0
- package/package.json +5 -3
- package/third_party_licenses/BLAKE2-NOTICE.txt +11 -0
- package/third_party_licenses/libarchive-COPYING +65 -0
- package/vendor/libarchive/PapyrusComicArchive.cpp +376 -0
- package/vendor/libarchive/PapyrusComicArchive.h +30 -0
- package/vendor/libarchive/README.papyrus.md +15 -0
- package/vendor/libarchive/android.h +192 -0
- package/vendor/libarchive/config/PapyrusArchiveConfig.h +65 -0
- package/vendor/libarchive/libarchive/CMakeLists.txt +293 -0
- package/vendor/libarchive/libarchive/android_lf.h +36 -0
- package/vendor/libarchive/libarchive/archive.h +1266 -0
- package/vendor/libarchive/libarchive/archive_acl.c +2025 -0
- package/vendor/libarchive/libarchive/archive_acl_private.h +85 -0
- package/vendor/libarchive/libarchive/archive_blake2.h +197 -0
- package/vendor/libarchive/libarchive/archive_blake2_impl.h +161 -0
- package/vendor/libarchive/libarchive/archive_blake2s_ref.c +369 -0
- package/vendor/libarchive/libarchive/archive_blake2sp_ref.c +361 -0
- package/vendor/libarchive/libarchive/archive_check_magic.c +183 -0
- package/vendor/libarchive/libarchive/archive_cmdline.c +211 -0
- package/vendor/libarchive/libarchive/archive_cmdline_private.h +45 -0
- package/vendor/libarchive/libarchive/archive_crc32.h +123 -0
- package/vendor/libarchive/libarchive/archive_cryptor.c +534 -0
- package/vendor/libarchive/libarchive/archive_cryptor_private.h +199 -0
- package/vendor/libarchive/libarchive/archive_digest.c +1584 -0
- package/vendor/libarchive/libarchive/archive_digest_private.h +431 -0
- package/vendor/libarchive/libarchive/archive_disk_acl_darwin.c +558 -0
- package/vendor/libarchive/libarchive/archive_disk_acl_freebsd.c +712 -0
- package/vendor/libarchive/libarchive/archive_disk_acl_linux.c +760 -0
- package/vendor/libarchive/libarchive/archive_disk_acl_sunos.c +824 -0
- package/vendor/libarchive/libarchive/archive_endian.h +234 -0
- package/vendor/libarchive/libarchive/archive_entry.3 +147 -0
- package/vendor/libarchive/libarchive/archive_entry.c +2297 -0
- package/vendor/libarchive/libarchive/archive_entry.h +763 -0
- package/vendor/libarchive/libarchive/archive_entry_acl.3 +458 -0
- package/vendor/libarchive/libarchive/archive_entry_copy_bhfi.c +55 -0
- package/vendor/libarchive/libarchive/archive_entry_copy_stat.c +82 -0
- package/vendor/libarchive/libarchive/archive_entry_link_resolver.c +472 -0
- package/vendor/libarchive/libarchive/archive_entry_linkify.3 +224 -0
- package/vendor/libarchive/libarchive/archive_entry_locale.h +90 -0
- package/vendor/libarchive/libarchive/archive_entry_misc.3 +63 -0
- package/vendor/libarchive/libarchive/archive_entry_paths.3 +153 -0
- package/vendor/libarchive/libarchive/archive_entry_perms.3 +210 -0
- package/vendor/libarchive/libarchive/archive_entry_private.h +205 -0
- package/vendor/libarchive/libarchive/archive_entry_sparse.c +156 -0
- package/vendor/libarchive/libarchive/archive_entry_stat.3 +274 -0
- package/vendor/libarchive/libarchive/archive_entry_stat.c +121 -0
- package/vendor/libarchive/libarchive/archive_entry_strmode.c +69 -0
- package/vendor/libarchive/libarchive/archive_entry_time.3 +127 -0
- package/vendor/libarchive/libarchive/archive_entry_xattr.c +155 -0
- package/vendor/libarchive/libarchive/archive_hmac.c +345 -0
- package/vendor/libarchive/libarchive/archive_hmac_private.h +119 -0
- package/vendor/libarchive/libarchive/archive_integer.h +267 -0
- package/vendor/libarchive/libarchive/archive_match.c +1869 -0
- package/vendor/libarchive/libarchive/archive_openssl_evp_private.h +54 -0
- package/vendor/libarchive/libarchive/archive_openssl_hmac_private.h +54 -0
- package/vendor/libarchive/libarchive/archive_options.c +219 -0
- package/vendor/libarchive/libarchive/archive_options_private.h +49 -0
- package/vendor/libarchive/libarchive/archive_pack_dev.c +330 -0
- package/vendor/libarchive/libarchive/archive_pack_dev.h +49 -0
- package/vendor/libarchive/libarchive/archive_parse_date.c +1173 -0
- package/vendor/libarchive/libarchive/archive_pathmatch.c +480 -0
- package/vendor/libarchive/libarchive/archive_pathmatch.h +50 -0
- package/vendor/libarchive/libarchive/archive_platform.h +213 -0
- package/vendor/libarchive/libarchive/archive_platform_acl.h +53 -0
- package/vendor/libarchive/libarchive/archive_platform_stat.h +45 -0
- package/vendor/libarchive/libarchive/archive_platform_xattr.h +45 -0
- package/vendor/libarchive/libarchive/archive_ppmd7.c +1173 -0
- package/vendor/libarchive/libarchive/archive_ppmd7_private.h +119 -0
- package/vendor/libarchive/libarchive/archive_ppmd8.c +1293 -0
- package/vendor/libarchive/libarchive/archive_ppmd8_private.h +123 -0
- package/vendor/libarchive/libarchive/archive_ppmd_private.h +159 -0
- package/vendor/libarchive/libarchive/archive_private.h +209 -0
- package/vendor/libarchive/libarchive/archive_random.c +274 -0
- package/vendor/libarchive/libarchive/archive_random_private.h +36 -0
- package/vendor/libarchive/libarchive/archive_rb.c +709 -0
- package/vendor/libarchive/libarchive/archive_rb.h +113 -0
- package/vendor/libarchive/libarchive/archive_read.3 +250 -0
- package/vendor/libarchive/libarchive/archive_read.c +1814 -0
- package/vendor/libarchive/libarchive/archive_read_add_passphrase.3 +72 -0
- package/vendor/libarchive/libarchive/archive_read_add_passphrase.c +189 -0
- package/vendor/libarchive/libarchive/archive_read_append_filter.c +209 -0
- package/vendor/libarchive/libarchive/archive_read_data.3 +128 -0
- package/vendor/libarchive/libarchive/archive_read_data_into_fd.c +207 -0
- package/vendor/libarchive/libarchive/archive_read_disk.3 +422 -0
- package/vendor/libarchive/libarchive/archive_read_disk_entry_from_file.c +1086 -0
- package/vendor/libarchive/libarchive/archive_read_disk_posix.c +2639 -0
- package/vendor/libarchive/libarchive/archive_read_disk_private.h +97 -0
- package/vendor/libarchive/libarchive/archive_read_disk_set_standard_lookup.c +315 -0
- package/vendor/libarchive/libarchive/archive_read_disk_windows.c +2603 -0
- package/vendor/libarchive/libarchive/archive_read_extract.3 +135 -0
- package/vendor/libarchive/libarchive/archive_read_extract.c +59 -0
- package/vendor/libarchive/libarchive/archive_read_extract2.c +154 -0
- package/vendor/libarchive/libarchive/archive_read_filter.3 +163 -0
- package/vendor/libarchive/libarchive/archive_read_format.3 +190 -0
- package/vendor/libarchive/libarchive/archive_read_free.3 +91 -0
- package/vendor/libarchive/libarchive/archive_read_header.3 +89 -0
- package/vendor/libarchive/libarchive/archive_read_new.3 +57 -0
- package/vendor/libarchive/libarchive/archive_read_open.3 +247 -0
- package/vendor/libarchive/libarchive/archive_read_open_fd.c +236 -0
- package/vendor/libarchive/libarchive/archive_read_open_file.c +257 -0
- package/vendor/libarchive/libarchive/archive_read_open_filename.c +652 -0
- package/vendor/libarchive/libarchive/archive_read_open_memory.c +188 -0
- package/vendor/libarchive/libarchive/archive_read_private.h +274 -0
- package/vendor/libarchive/libarchive/archive_read_set_format.c +116 -0
- package/vendor/libarchive/libarchive/archive_read_set_options.3 +290 -0
- package/vendor/libarchive/libarchive/archive_read_set_options.c +132 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_all.c +84 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_by_code.c +68 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_bzip2.c +360 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_compress.c +457 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_grzip.c +108 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_gzip.c +538 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_lrzip.c +119 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_lz4.c +829 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_lzop.c +493 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_none.c +51 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_program.c +497 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_rpm.c +249 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_uu.c +739 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_xz.c +792 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_zstd.c +356 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_7zip.c +4650 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_all.c +88 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_ar.c +597 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_by_code.c +76 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_cab.c +3410 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_cpio.c +1152 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_empty.c +95 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_iso9660.c +3516 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_lha.c +2931 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_mtree.c +2113 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_rar.c +3932 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_rar5.c +4501 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_raw.c +194 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_tar.c +3785 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_warc.c +875 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_xar.c +3770 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_zip.c +4710 -0
- package/vendor/libarchive/libarchive/archive_string.c +4391 -0
- package/vendor/libarchive/libarchive/archive_string.h +244 -0
- package/vendor/libarchive/libarchive/archive_string_composition.h +2289 -0
- package/vendor/libarchive/libarchive/archive_string_sprintf.c +200 -0
- package/vendor/libarchive/libarchive/archive_time.c +168 -0
- package/vendor/libarchive/libarchive/archive_time_private.h +47 -0
- package/vendor/libarchive/libarchive/archive_util.3 +239 -0
- package/vendor/libarchive/libarchive/archive_util.c +668 -0
- package/vendor/libarchive/libarchive/archive_version_details.c +516 -0
- package/vendor/libarchive/libarchive/archive_virtual.c +162 -0
- package/vendor/libarchive/libarchive/archive_windows.c +1035 -0
- package/vendor/libarchive/libarchive/archive_windows.h +332 -0
- package/vendor/libarchive/libarchive/archive_write.3 +266 -0
- package/vendor/libarchive/libarchive/archive_write.c +896 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter.c +71 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_b64encode.c +329 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_by_name.c +76 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_bzip2.c +411 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_compress.c +459 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_grzip.c +143 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_gzip.c +493 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_lrzip.c +214 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_lz4.c +710 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_lzop.c +500 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_none.c +42 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_program.c +398 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_uuencode.c +320 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_xz.c +547 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_zstd.c +608 -0
- package/vendor/libarchive/libarchive/archive_write_blocksize.3 +112 -0
- package/vendor/libarchive/libarchive/archive_write_data.3 +88 -0
- package/vendor/libarchive/libarchive/archive_write_disk.3 +360 -0
- package/vendor/libarchive/libarchive/archive_write_disk_posix.c +4789 -0
- package/vendor/libarchive/libarchive/archive_write_disk_private.h +43 -0
- package/vendor/libarchive/libarchive/archive_write_disk_set_standard_lookup.c +265 -0
- package/vendor/libarchive/libarchive/archive_write_disk_windows.c +2952 -0
- package/vendor/libarchive/libarchive/archive_write_filter.3 +140 -0
- package/vendor/libarchive/libarchive/archive_write_finish_entry.3 +77 -0
- package/vendor/libarchive/libarchive/archive_write_format.3 +187 -0
- package/vendor/libarchive/libarchive/archive_write_free.3 +94 -0
- package/vendor/libarchive/libarchive/archive_write_header.3 +71 -0
- package/vendor/libarchive/libarchive/archive_write_new.3 +56 -0
- package/vendor/libarchive/libarchive/archive_write_open.3 +270 -0
- package/vendor/libarchive/libarchive/archive_write_open_fd.c +141 -0
- package/vendor/libarchive/libarchive/archive_write_open_file.c +102 -0
- package/vendor/libarchive/libarchive/archive_write_open_filename.c +272 -0
- package/vendor/libarchive/libarchive/archive_write_open_memory.c +110 -0
- package/vendor/libarchive/libarchive/archive_write_private.h +166 -0
- package/vendor/libarchive/libarchive/archive_write_set_format.c +124 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_7zip.c +2571 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_ar.c +540 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_by_name.c +93 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio.c +11 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_binary.c +618 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_newc.c +457 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_odc.c +508 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_filter_by_ext.c +141 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_gnutar.c +790 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_iso9660.c +8216 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_mtree.c +2307 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_pax.c +2249 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_private.h +40 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_raw.c +123 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_shar.c +650 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_ustar.c +768 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_v7tar.c +648 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_warc.c +491 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_xar.c +3799 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_zip.c +2548 -0
- package/vendor/libarchive/libarchive/archive_write_set_options.3 +779 -0
- package/vendor/libarchive/libarchive/archive_write_set_options.c +129 -0
- package/vendor/libarchive/libarchive/archive_write_set_passphrase.3 +72 -0
- package/vendor/libarchive/libarchive/archive_write_set_passphrase.c +95 -0
- package/vendor/libarchive/libarchive/archive_xxhash.h +48 -0
- package/vendor/libarchive/libarchive/config_freebsd.h +275 -0
- package/vendor/libarchive/libarchive/cpio.5 +389 -0
- package/vendor/libarchive/libarchive/filter_fork.h +44 -0
- package/vendor/libarchive/libarchive/filter_fork_posix.c +269 -0
- package/vendor/libarchive/libarchive/filter_fork_windows.c +270 -0
- package/vendor/libarchive/libarchive/libarchive-formats.5 +478 -0
- package/vendor/libarchive/libarchive/libarchive.3 +297 -0
- package/vendor/libarchive/libarchive/libarchive_changes.3 +339 -0
- package/vendor/libarchive/libarchive/libarchive_internals.3 +363 -0
- package/vendor/libarchive/libarchive/module.modulemap +34 -0
- package/vendor/libarchive/libarchive/mtree.5 +323 -0
- package/vendor/libarchive/libarchive/tar.5 +947 -0
- package/vendor/libarchive/libarchive/xxhash.c +531 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/*-
|
|
2
|
+
* Copyright (c) 2003-2007 Tim Kientzle
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions
|
|
7
|
+
* are met:
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
*
|
|
14
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
|
15
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
16
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
17
|
+
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
18
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
19
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
20
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
21
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
22
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
23
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
#include "archive_platform.h"
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
* The use of printf()-family functions can be troublesome
|
|
30
|
+
* for space-constrained applications. In addition, correctly
|
|
31
|
+
* implementing this function in terms of vsnprintf() requires
|
|
32
|
+
* two calls (one to determine the size, another to format the
|
|
33
|
+
* result), which in turn requires duplicating the argument list
|
|
34
|
+
* using va_copy, which isn't yet universally available. <sigh>
|
|
35
|
+
*
|
|
36
|
+
* So, I've implemented a bare minimum of printf()-like capability
|
|
37
|
+
* here. This is only used to format error messages, so doesn't
|
|
38
|
+
* require any floating-point support or field-width handling.
|
|
39
|
+
*/
|
|
40
|
+
#ifdef HAVE_ERRNO_H
|
|
41
|
+
#include <errno.h>
|
|
42
|
+
#endif
|
|
43
|
+
#include <stdio.h>
|
|
44
|
+
|
|
45
|
+
#include "archive_string.h"
|
|
46
|
+
#include "archive_private.h"
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
* Utility functions to format signed/unsigned integers and append
|
|
50
|
+
* them to an archive_string.
|
|
51
|
+
*/
|
|
52
|
+
static void
|
|
53
|
+
append_uint(struct archive_string *as, uintmax_t d, unsigned base)
|
|
54
|
+
{
|
|
55
|
+
static const char digits[] = "0123456789abcdef";
|
|
56
|
+
if (d >= base)
|
|
57
|
+
append_uint(as, d/base, base);
|
|
58
|
+
archive_strappend_char(as, digits[d % base]);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static void
|
|
62
|
+
append_int(struct archive_string *as, intmax_t d, unsigned base)
|
|
63
|
+
{
|
|
64
|
+
uintmax_t ud;
|
|
65
|
+
|
|
66
|
+
if (d < 0) {
|
|
67
|
+
archive_strappend_char(as, '-');
|
|
68
|
+
ud = (d == INTMAX_MIN) ? (uintmax_t)(INTMAX_MAX) + 1 : (uintmax_t)(-d);
|
|
69
|
+
} else
|
|
70
|
+
ud = d;
|
|
71
|
+
append_uint(as, ud, base);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
void
|
|
76
|
+
archive_string_sprintf(struct archive_string *as, const char *fmt, ...)
|
|
77
|
+
{
|
|
78
|
+
va_list ap;
|
|
79
|
+
|
|
80
|
+
va_start(ap, fmt);
|
|
81
|
+
archive_string_vsprintf(as, fmt, ap);
|
|
82
|
+
va_end(ap);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/*
|
|
86
|
+
* Like 'vsprintf', but ensures the target is big enough, resizing if
|
|
87
|
+
* necessary.
|
|
88
|
+
*/
|
|
89
|
+
void
|
|
90
|
+
archive_string_vsprintf(struct archive_string *as, const char *fmt,
|
|
91
|
+
va_list ap)
|
|
92
|
+
{
|
|
93
|
+
char long_flag;
|
|
94
|
+
intmax_t s; /* Signed integer temp. */
|
|
95
|
+
uintmax_t u; /* Unsigned integer temp. */
|
|
96
|
+
const char *p, *p2;
|
|
97
|
+
const wchar_t *pw;
|
|
98
|
+
|
|
99
|
+
if (archive_string_ensure(as, 64) == NULL)
|
|
100
|
+
__archive_errx(1, "Out of memory");
|
|
101
|
+
|
|
102
|
+
if (fmt == NULL) {
|
|
103
|
+
as->s[0] = 0;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
for (p = fmt; *p != '\0'; p++) {
|
|
108
|
+
const char *saved_p = p;
|
|
109
|
+
|
|
110
|
+
if (*p != '%') {
|
|
111
|
+
archive_strappend_char(as, *p);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
p++;
|
|
116
|
+
|
|
117
|
+
long_flag = '\0';
|
|
118
|
+
switch(*p) {
|
|
119
|
+
case 'l':
|
|
120
|
+
if (p[1] == 'l') {
|
|
121
|
+
long_flag = 'L';
|
|
122
|
+
p += 2;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
__LA_FALLTHROUGH;
|
|
126
|
+
case 'j':
|
|
127
|
+
case 'z':
|
|
128
|
+
long_flag = *p;
|
|
129
|
+
p++;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
switch (*p) {
|
|
134
|
+
case '%':
|
|
135
|
+
archive_strappend_char(as, '%');
|
|
136
|
+
break;
|
|
137
|
+
case 'c':
|
|
138
|
+
s = va_arg(ap, int);
|
|
139
|
+
archive_strappend_char(as, (char)s);
|
|
140
|
+
break;
|
|
141
|
+
case 'd':
|
|
142
|
+
switch(long_flag) {
|
|
143
|
+
case 'j': s = va_arg(ap, intmax_t); break;
|
|
144
|
+
case 'l': s = va_arg(ap, long); break;
|
|
145
|
+
case 'L': s = va_arg(ap, long long); break;
|
|
146
|
+
case 'z': s = va_arg(ap, ssize_t); break;
|
|
147
|
+
default: s = va_arg(ap, int); break;
|
|
148
|
+
}
|
|
149
|
+
append_int(as, s, 10);
|
|
150
|
+
break;
|
|
151
|
+
case 's':
|
|
152
|
+
switch(long_flag) {
|
|
153
|
+
case 'l':
|
|
154
|
+
case 'L':
|
|
155
|
+
pw = va_arg(ap, wchar_t *);
|
|
156
|
+
if (pw == NULL)
|
|
157
|
+
pw = L"(null)";
|
|
158
|
+
if (archive_string_append_from_wcs(as, pw,
|
|
159
|
+
wcslen(pw)) != 0 && errno == ENOMEM)
|
|
160
|
+
__archive_errx(1, "Out of memory");
|
|
161
|
+
break;
|
|
162
|
+
default:
|
|
163
|
+
p2 = va_arg(ap, char *);
|
|
164
|
+
if (p2 == NULL)
|
|
165
|
+
p2 = "(null)";
|
|
166
|
+
archive_strcat(as, p2);
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
break;
|
|
170
|
+
case 'S':
|
|
171
|
+
pw = va_arg(ap, wchar_t *);
|
|
172
|
+
if (pw == NULL)
|
|
173
|
+
pw = L"(null)";
|
|
174
|
+
if (archive_string_append_from_wcs(as, pw,
|
|
175
|
+
wcslen(pw)) != 0 && errno == ENOMEM)
|
|
176
|
+
__archive_errx(1, "Out of memory");
|
|
177
|
+
break;
|
|
178
|
+
case 'o': case 'u': case 'x': case 'X':
|
|
179
|
+
/* Common handling for unsigned integer formats. */
|
|
180
|
+
switch(long_flag) {
|
|
181
|
+
case 'j': u = va_arg(ap, uintmax_t); break;
|
|
182
|
+
case 'l': u = va_arg(ap, unsigned long); break;
|
|
183
|
+
case 'L': u = va_arg(ap, unsigned long long); break;
|
|
184
|
+
case 'z': u = va_arg(ap, size_t); break;
|
|
185
|
+
default: u = va_arg(ap, unsigned int); break;
|
|
186
|
+
}
|
|
187
|
+
/* Format it in the correct base. */
|
|
188
|
+
switch (*p) {
|
|
189
|
+
case 'o': append_uint(as, u, 8); break;
|
|
190
|
+
case 'u': append_uint(as, u, 10); break;
|
|
191
|
+
default: append_uint(as, u, 16); break;
|
|
192
|
+
}
|
|
193
|
+
break;
|
|
194
|
+
default:
|
|
195
|
+
/* Rewind and print the initial '%' literally. */
|
|
196
|
+
p = saved_p;
|
|
197
|
+
archive_strappend_char(as, *p);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/*-
|
|
2
|
+
* Copyright © 2025 ARJANEN Loïc Jean David
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions
|
|
7
|
+
* are met:
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
*
|
|
14
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
|
15
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
16
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
17
|
+
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
18
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
19
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
20
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
21
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
22
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
23
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
#include "archive_platform.h"
|
|
27
|
+
|
|
28
|
+
#ifdef HAVE_LIMITS_H
|
|
29
|
+
#include <limits.h>
|
|
30
|
+
#endif
|
|
31
|
+
#ifdef HAVE_STDLIB_H
|
|
32
|
+
#include <stdlib.h>
|
|
33
|
+
#endif
|
|
34
|
+
#ifdef HAVE_STRING_H
|
|
35
|
+
#include <string.h>
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
#include "archive_integer.h"
|
|
39
|
+
#include "archive_private.h"
|
|
40
|
+
#include "archive_time_private.h"
|
|
41
|
+
|
|
42
|
+
#define NTFS_EPOC_TIME ARCHIVE_LITERAL_ULL(11644473600)
|
|
43
|
+
#define NTFS_TICKS ARCHIVE_LITERAL_ULL(10000000)
|
|
44
|
+
#define NTFS_EPOC_TICKS (NTFS_EPOC_TIME * NTFS_TICKS)
|
|
45
|
+
#define DOS_MIN_TIME 0x00210000U
|
|
46
|
+
#define DOS_MAX_TIME 0xff9fbf7dU
|
|
47
|
+
|
|
48
|
+
#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
49
|
+
#include <winnt.h>
|
|
50
|
+
/* Windows FILETIME to NTFS time. */
|
|
51
|
+
uint64_t
|
|
52
|
+
FILETIME_to_ntfs(const FILETIME* filetime)
|
|
53
|
+
{
|
|
54
|
+
ULARGE_INTEGER utc;
|
|
55
|
+
utc.HighPart = filetime->dwHighDateTime;
|
|
56
|
+
utc.LowPart = filetime->dwLowDateTime;
|
|
57
|
+
return utc.QuadPart;
|
|
58
|
+
}
|
|
59
|
+
#endif
|
|
60
|
+
|
|
61
|
+
/* Convert an MSDOS-style date/time into Unix-style time. */
|
|
62
|
+
int64_t
|
|
63
|
+
dos_to_unix(uint32_t dos_time)
|
|
64
|
+
{
|
|
65
|
+
uint16_t msTime, msDate;
|
|
66
|
+
struct tm ts;
|
|
67
|
+
time_t t;
|
|
68
|
+
|
|
69
|
+
msTime = (0xFFFF & dos_time);
|
|
70
|
+
msDate = (dos_time >> 16);
|
|
71
|
+
|
|
72
|
+
memset(&ts, 0, sizeof(ts));
|
|
73
|
+
ts.tm_year = ((msDate >> 9) & 0x7f) + 80; /* Years since 1900. */
|
|
74
|
+
ts.tm_mon = ((msDate >> 5) & 0x0f) - 1; /* Month number. */
|
|
75
|
+
ts.tm_mday = msDate & 0x1f; /* Day of month. */
|
|
76
|
+
ts.tm_hour = (msTime >> 11) & 0x1f;
|
|
77
|
+
ts.tm_min = (msTime >> 5) & 0x3f;
|
|
78
|
+
ts.tm_sec = (msTime << 1) & 0x3e;
|
|
79
|
+
ts.tm_isdst = -1;
|
|
80
|
+
t = mktime(&ts);
|
|
81
|
+
return (int64_t)(t == (time_t)-1 ? INT32_MAX : t);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Convert into MSDOS-style date/time. */
|
|
85
|
+
uint32_t
|
|
86
|
+
unix_to_dos(int64_t unix_time)
|
|
87
|
+
{
|
|
88
|
+
struct tm *t;
|
|
89
|
+
uint32_t dt;
|
|
90
|
+
time_t ut = unix_time;
|
|
91
|
+
#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
|
|
92
|
+
struct tm tmbuf;
|
|
93
|
+
#endif
|
|
94
|
+
|
|
95
|
+
if (sizeof(time_t) < sizeof(int64_t) && (int64_t)ut != unix_time) {
|
|
96
|
+
ut = (time_t)(unix_time > 0 ? INT32_MAX : INT32_MIN);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
#if defined(HAVE_LOCALTIME_S)
|
|
100
|
+
t = localtime_s(&tmbuf, &ut) ? NULL : &tmbuf;
|
|
101
|
+
#elif defined(HAVE_LOCALTIME_R)
|
|
102
|
+
t = localtime_r(&ut, &tmbuf);
|
|
103
|
+
#else
|
|
104
|
+
t = localtime(&ut);
|
|
105
|
+
#endif
|
|
106
|
+
dt = 0;
|
|
107
|
+
if (t != NULL && t->tm_year >= INT_MIN + 80) {
|
|
108
|
+
const int year = t->tm_year - 80;
|
|
109
|
+
|
|
110
|
+
if (year & ~0x7f) {
|
|
111
|
+
dt = year > 0 ? DOS_MAX_TIME : DOS_MIN_TIME;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
dt += (year & 0x7f) << 9;
|
|
115
|
+
dt += ((t->tm_mon + 1) & 0x0f) << 5;
|
|
116
|
+
dt += (t->tm_mday & 0x1f);
|
|
117
|
+
dt <<= 16;
|
|
118
|
+
dt += (t->tm_hour & 0x1f) << 11;
|
|
119
|
+
dt += (t->tm_min & 0x3f) << 5;
|
|
120
|
+
/* Only counting every 2 seconds. */
|
|
121
|
+
dt += (t->tm_sec & 0x3e) >> 1;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (dt > DOS_MAX_TIME) {
|
|
125
|
+
dt = DOS_MAX_TIME;
|
|
126
|
+
}
|
|
127
|
+
else if (dt < DOS_MIN_TIME) {
|
|
128
|
+
dt = DOS_MIN_TIME;
|
|
129
|
+
}
|
|
130
|
+
return dt;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Convert NTFS time to Unix sec/nsec */
|
|
134
|
+
void
|
|
135
|
+
ntfs_to_unix(uint64_t ntfs, int64_t* secs, uint32_t* nsecs)
|
|
136
|
+
{
|
|
137
|
+
if (ntfs > INT64_MAX) {
|
|
138
|
+
ntfs -= NTFS_EPOC_TICKS;
|
|
139
|
+
*secs = ntfs / NTFS_TICKS;
|
|
140
|
+
*nsecs = 100 * (ntfs % NTFS_TICKS);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
lldiv_t tdiv;
|
|
144
|
+
int64_t value = (int64_t)ntfs - (int64_t)NTFS_EPOC_TICKS;
|
|
145
|
+
|
|
146
|
+
tdiv = lldiv(value, NTFS_TICKS);
|
|
147
|
+
*secs = tdiv.quot;
|
|
148
|
+
*nsecs = (uint32_t)(tdiv.rem * 100);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* Convert Unix sec/nsec to NTFS time */
|
|
153
|
+
uint64_t
|
|
154
|
+
unix_to_ntfs(int64_t secs, uint32_t nsecs)
|
|
155
|
+
{
|
|
156
|
+
uint64_t ntfs;
|
|
157
|
+
|
|
158
|
+
if (secs < -(int64_t)NTFS_EPOC_TIME)
|
|
159
|
+
return 0;
|
|
160
|
+
|
|
161
|
+
/* (secs + NTFS_EPOC_TIME) * NTFS_TICKS + nsecs / 100 */
|
|
162
|
+
if (archive_ckd_add_u64(&ntfs, secs, NTFS_EPOC_TIME) ||
|
|
163
|
+
archive_ckd_mul_u64(&ntfs, ntfs, NTFS_TICKS) ||
|
|
164
|
+
archive_ckd_add_u64(&ntfs, ntfs, nsecs / 100))
|
|
165
|
+
return UINT64_MAX;
|
|
166
|
+
|
|
167
|
+
return ntfs;
|
|
168
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*-
|
|
2
|
+
* Copyright © 2025 ARJANEN Loïc Jean David
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions
|
|
7
|
+
* are met:
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
*
|
|
14
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
|
15
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
16
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
17
|
+
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
18
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
19
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
20
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
21
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
22
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
23
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
*/
|
|
25
|
+
#ifndef ARCHIVE_TIME_PRIVATE_H_INCLUDED
|
|
26
|
+
#define ARCHIVE_TIME_PRIVATE_H_INCLUDED
|
|
27
|
+
|
|
28
|
+
#ifndef __LIBARCHIVE_BUILD
|
|
29
|
+
#error This header is only to be used internally to libarchive.
|
|
30
|
+
#endif
|
|
31
|
+
#include <stdint.h>
|
|
32
|
+
|
|
33
|
+
/* NTFS time to Unix sec/nsec. */
|
|
34
|
+
void ntfs_to_unix(uint64_t ntfs, int64_t* secs, uint32_t* nsecs);
|
|
35
|
+
/* DOS time to Unix sec. */
|
|
36
|
+
int64_t dos_to_unix(uint32_t dos);
|
|
37
|
+
/* Unix sec/nsec to NTFS time. */
|
|
38
|
+
uint64_t unix_to_ntfs(int64_t secs, uint32_t nsecs);
|
|
39
|
+
/* Unix sec to DOS time. */
|
|
40
|
+
uint32_t unix_to_dos(int64_t secs);
|
|
41
|
+
#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
42
|
+
#include <windef.h>
|
|
43
|
+
#include <winbase.h>
|
|
44
|
+
/* Windows FILETIME to NTFS time. */
|
|
45
|
+
uint64_t FILETIME_to_ntfs(const FILETIME* filetime);
|
|
46
|
+
#endif
|
|
47
|
+
#endif /* ARCHIVE_TIME_PRIVATE_H_INCLUDED */
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
.\" Copyright (c) 2003-2007 Tim Kientzle
|
|
2
|
+
.\" All rights reserved.
|
|
3
|
+
.\"
|
|
4
|
+
.\" Redistribution and use in source and binary forms, with or without
|
|
5
|
+
.\" modification, are permitted provided that the following conditions
|
|
6
|
+
.\" are met:
|
|
7
|
+
.\" 1. Redistributions of source code must retain the above copyright
|
|
8
|
+
.\" notice, this list of conditions and the following disclaimer.
|
|
9
|
+
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
10
|
+
.\" notice, this list of conditions and the following disclaimer in the
|
|
11
|
+
.\" documentation and/or other materials provided with the distribution.
|
|
12
|
+
.\"
|
|
13
|
+
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
14
|
+
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
15
|
+
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
16
|
+
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
17
|
+
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
18
|
+
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
19
|
+
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
20
|
+
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
21
|
+
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
22
|
+
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
23
|
+
.\" SUCH DAMAGE.
|
|
24
|
+
.\"
|
|
25
|
+
.Dd February 2, 2012
|
|
26
|
+
.Dt ARCHIVE_UTIL 3
|
|
27
|
+
.Os
|
|
28
|
+
.Sh NAME
|
|
29
|
+
.Nm archive_clear_error ,
|
|
30
|
+
.Nm archive_compression ,
|
|
31
|
+
.Nm archive_compression_name ,
|
|
32
|
+
.Nm archive_copy_error ,
|
|
33
|
+
.Nm archive_errno ,
|
|
34
|
+
.Nm archive_error_string ,
|
|
35
|
+
.Nm archive_file_count ,
|
|
36
|
+
.Nm archive_filter_bytes ,
|
|
37
|
+
.Nm archive_filter_code ,
|
|
38
|
+
.Nm archive_filter_count ,
|
|
39
|
+
.Nm archive_filter_name ,
|
|
40
|
+
.Nm archive_format ,
|
|
41
|
+
.Nm archive_format_name ,
|
|
42
|
+
.Nm archive_free ,
|
|
43
|
+
.Nm archive_position_compressed ,
|
|
44
|
+
.Nm archive_position_uncompressed ,
|
|
45
|
+
.Nm archive_set_error
|
|
46
|
+
.Nd libarchive utility functions
|
|
47
|
+
.Sh LIBRARY
|
|
48
|
+
Streaming Archive Library (libarchive, -larchive)
|
|
49
|
+
.Sh SYNOPSIS
|
|
50
|
+
.In archive.h
|
|
51
|
+
.Ft void
|
|
52
|
+
.Fn archive_clear_error "struct archive *"
|
|
53
|
+
.Ft int
|
|
54
|
+
.Fn archive_compression "struct archive *"
|
|
55
|
+
.Ft const char *
|
|
56
|
+
.Fn archive_compression_name "struct archive *"
|
|
57
|
+
.Ft void
|
|
58
|
+
.Fn archive_copy_error "struct archive *" "struct archive *"
|
|
59
|
+
.Ft int
|
|
60
|
+
.Fn archive_errno "struct archive *"
|
|
61
|
+
.Ft const char *
|
|
62
|
+
.Fn archive_error_string "struct archive *"
|
|
63
|
+
.Ft int
|
|
64
|
+
.Fn archive_file_count "struct archive *"
|
|
65
|
+
.Ft int64_t
|
|
66
|
+
.Fn archive_filter_bytes "struct archive *" "int"
|
|
67
|
+
.Ft int
|
|
68
|
+
.Fn archive_filter_code "struct archive *" "int"
|
|
69
|
+
.Ft int
|
|
70
|
+
.Fn archive_filter_count "struct archive *" "int"
|
|
71
|
+
.Ft const char *
|
|
72
|
+
.Fn archive_filter_name "struct archive *" "int"
|
|
73
|
+
.Ft int
|
|
74
|
+
.Fn archive_format "struct archive *"
|
|
75
|
+
.Ft const char *
|
|
76
|
+
.Fn archive_format_name "struct archive *"
|
|
77
|
+
.Ft int
|
|
78
|
+
.Fn archive_free "struct archive *"
|
|
79
|
+
.Ft int64_t
|
|
80
|
+
.Fn archive_position_compressed "struct archive *"
|
|
81
|
+
.Ft int64_t
|
|
82
|
+
.Fn archive_position_uncompressed "struct archive *"
|
|
83
|
+
.Ft void
|
|
84
|
+
.Fo archive_set_error
|
|
85
|
+
.Fa "struct archive *"
|
|
86
|
+
.Fa "int error_code"
|
|
87
|
+
.Fa "const char *fmt"
|
|
88
|
+
.Fa "..."
|
|
89
|
+
.Fc
|
|
90
|
+
.Sh DESCRIPTION
|
|
91
|
+
These functions provide access to various information about the
|
|
92
|
+
.Tn struct archive
|
|
93
|
+
object used in the
|
|
94
|
+
.Xr libarchive 3
|
|
95
|
+
library.
|
|
96
|
+
.Bl -tag -compact -width indent
|
|
97
|
+
.It Fn archive_clear_error
|
|
98
|
+
Clears any error information left over from a previous call.
|
|
99
|
+
Not generally used in client code.
|
|
100
|
+
.It Fn archive_compression
|
|
101
|
+
Synonym for
|
|
102
|
+
.Fn archive_filter_code a 0 .
|
|
103
|
+
.It Fn archive_compression_name
|
|
104
|
+
Synonym for
|
|
105
|
+
.Fn archive_filter_name a 0 .
|
|
106
|
+
.It Fn archive_copy_error
|
|
107
|
+
Copies error information from one archive to another.
|
|
108
|
+
.It Fn archive_errno
|
|
109
|
+
Returns a numeric error code (see
|
|
110
|
+
.Xr errno 2 )
|
|
111
|
+
indicating the reason for the most recent error return.
|
|
112
|
+
Note that this can not be reliably used to detect whether an
|
|
113
|
+
error has occurred.
|
|
114
|
+
It should be used only after another libarchive function
|
|
115
|
+
has returned an error status.
|
|
116
|
+
.It Fn archive_error_string
|
|
117
|
+
Returns a textual error message suitable for display.
|
|
118
|
+
The error message here is usually more specific than that
|
|
119
|
+
obtained from passing the result of
|
|
120
|
+
.Fn archive_errno
|
|
121
|
+
to
|
|
122
|
+
.Xr strerror 3 .
|
|
123
|
+
.It Fn archive_file_count
|
|
124
|
+
Returns a count of the number of files processed by this archive object.
|
|
125
|
+
The count is incremented by calls to
|
|
126
|
+
.Xr archive_write_header 3
|
|
127
|
+
or
|
|
128
|
+
.Xr archive_read_next_header 3 .
|
|
129
|
+
.It Fn archive_filter_code
|
|
130
|
+
Returns a numeric code identifying the indicated filter.
|
|
131
|
+
See
|
|
132
|
+
.Fn archive_filter_count
|
|
133
|
+
for details of the numbering.
|
|
134
|
+
.It Fn archive_filter_count
|
|
135
|
+
Returns the number of filters in the current pipeline.
|
|
136
|
+
For read archive handles, these filters are added automatically
|
|
137
|
+
by the automatic format detection.
|
|
138
|
+
For write archive handles, these filters are added by calls to the various
|
|
139
|
+
.Fn archive_write_add_filter_XXX
|
|
140
|
+
functions.
|
|
141
|
+
Filters in the resulting pipeline are numbered so that filter 0
|
|
142
|
+
is the filter closest to the format handler.
|
|
143
|
+
As a convenience, functions that expect a filter number will
|
|
144
|
+
accept -1 as a synonym for the highest-numbered filter.
|
|
145
|
+
.Pp
|
|
146
|
+
For example, when reading a uuencoded gzipped tar archive, there
|
|
147
|
+
are three filters:
|
|
148
|
+
filter 0 is the gunzip filter,
|
|
149
|
+
filter 1 is the uudecode filter,
|
|
150
|
+
and filter 2 is the pseudo-filter that wraps the archive read functions.
|
|
151
|
+
In this case, requesting
|
|
152
|
+
.Fn archive_filter_bytes a -1
|
|
153
|
+
would be a synonym for
|
|
154
|
+
.Fn archive_filter_bytes a 2
|
|
155
|
+
which would return the number of bytes currently read from the archive, while
|
|
156
|
+
.Fn archive_filter_bytes a 1
|
|
157
|
+
would return the number of bytes after uudecoding, and
|
|
158
|
+
.Fn archive_filter_bytes a 0
|
|
159
|
+
would return the number of bytes after decompression.
|
|
160
|
+
.It Fn archive_filter_name
|
|
161
|
+
Returns a textual name identifying the indicated filter.
|
|
162
|
+
See
|
|
163
|
+
.Fn archive_filter_count
|
|
164
|
+
for details of the numbering.
|
|
165
|
+
.It Fn archive_format
|
|
166
|
+
Returns a numeric code indicating the format of the current
|
|
167
|
+
archive entry.
|
|
168
|
+
This value is set by a successful call to
|
|
169
|
+
.Fn archive_read_next_header .
|
|
170
|
+
Note that it is common for this value to change from
|
|
171
|
+
entry to entry.
|
|
172
|
+
For example, a tar archive might have several entries that
|
|
173
|
+
utilize GNU tar extensions and several entries that do not.
|
|
174
|
+
These entries will have different format codes.
|
|
175
|
+
.It Fn archive_format_name
|
|
176
|
+
A textual description of the format of the current entry.
|
|
177
|
+
.It Fn archive_free
|
|
178
|
+
Closes the archive if necessary, then releases all resources.
|
|
179
|
+
.It Fn archive_filter_bytes
|
|
180
|
+
Returns the number of bytes read from or written to the indicated filter.
|
|
181
|
+
In particular,
|
|
182
|
+
.Fn archive_filter_bytes a 0
|
|
183
|
+
returns the number of bytes read or written by the format handler, while
|
|
184
|
+
.Fn archive_filter_bytes a -1
|
|
185
|
+
returns the number of bytes read or written to the archive.
|
|
186
|
+
See
|
|
187
|
+
.Fn archive_filter_count
|
|
188
|
+
for details of the numbering here.
|
|
189
|
+
.It Fn archive_position_compressed
|
|
190
|
+
Synonym for
|
|
191
|
+
.Fn archive_filter_bytes a -1 .
|
|
192
|
+
.It Fn archive_position_uncompressed
|
|
193
|
+
Synonym for
|
|
194
|
+
.Fn archive_filter_bytes a 0 .
|
|
195
|
+
.It Fn archive_set_error
|
|
196
|
+
Sets the numeric error code and error description that will be returned
|
|
197
|
+
by
|
|
198
|
+
.Fn archive_errno
|
|
199
|
+
and
|
|
200
|
+
.Fn archive_error_string .
|
|
201
|
+
This function should be used within I/O callbacks to set system-specific
|
|
202
|
+
error codes and error descriptions.
|
|
203
|
+
This function accepts a printf-like format string and arguments.
|
|
204
|
+
However, you should be careful to use only the following printf
|
|
205
|
+
format specifiers:
|
|
206
|
+
.Dq %c ,
|
|
207
|
+
.Dq %d ,
|
|
208
|
+
.Dq %jd ,
|
|
209
|
+
.Dq %jo ,
|
|
210
|
+
.Dq %ju ,
|
|
211
|
+
.Dq %jx ,
|
|
212
|
+
.Dq %ld ,
|
|
213
|
+
.Dq %lo ,
|
|
214
|
+
.Dq %lu ,
|
|
215
|
+
.Dq %lx ,
|
|
216
|
+
.Dq %o ,
|
|
217
|
+
.Dq %u ,
|
|
218
|
+
.Dq %s ,
|
|
219
|
+
.Dq %x ,
|
|
220
|
+
.Dq %% .
|
|
221
|
+
Field-width specifiers and other printf features are
|
|
222
|
+
not uniformly supported and should not be used.
|
|
223
|
+
.El
|
|
224
|
+
.Sh SEE ALSO
|
|
225
|
+
.Xr archive_read 3 ,
|
|
226
|
+
.Xr archive_write 3 ,
|
|
227
|
+
.Xr libarchive 3 ,
|
|
228
|
+
.Xr printf 3
|
|
229
|
+
.Sh HISTORY
|
|
230
|
+
The
|
|
231
|
+
.Nm libarchive
|
|
232
|
+
library first appeared in
|
|
233
|
+
.Fx 5.3 .
|
|
234
|
+
.Sh AUTHORS
|
|
235
|
+
.An -nosplit
|
|
236
|
+
The
|
|
237
|
+
.Nm libarchive
|
|
238
|
+
library was written by
|
|
239
|
+
.An Tim Kientzle Aq kientzle@acm.org .
|