@papyrus-sdk/engine-native 0.2.22-beta.8 → 0.2.22-beta.9.epub.2
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 +0 -1
- package/android/src/main/cpp/CMakeLists.txt +0 -137
- package/android/src/main/java/com/papyrus/engine/PapyrusNativeEngineModule.java +35 -305
- package/android/src/main/java/com/papyrus/engine/PapyrusPackage.java +1 -3
- package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerView.java +5 -195
- package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerViewManager.java +1 -20
- package/dist/index.d.mts +4 -608
- package/dist/index.d.ts +4 -608
- package/dist/index.js +8 -463
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -456
- package/dist/index.mjs.map +1 -1
- package/ios/PapyrusEngineStore.h +0 -3
- package/ios/PapyrusEngineStore.m +6 -32
- package/ios/PapyrusNativeEngine.m +5 -684
- package/ios/PapyrusNativeEngine.podspec +15 -0
- package/ios/PapyrusPageView.m +11 -38
- package/package.json +4 -6
- package/react-native.config.js +1 -1
- package/PapyrusNativeEngine.podspec +0 -45
- package/android/src/main/cpp/PapyrusComicArchiveJni.cpp +0 -68
- package/android/src/main/cpp/PapyrusComicArchiveTest.cpp +0 -55
- package/android/src/main/java/com/papyrus/engine/PapyrusComicArchiveNative.java +0 -14
- package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentView.java +0 -491
- package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentViewManager.java +0 -32
- package/android/src/main/java/com/papyrus/engine/PapyrusComicPageLayout.java +0 -38
- package/android/src/main/java/com/papyrus/engine/PapyrusNativeTextModel.java +0 -195
- package/android/src/main/java/com/papyrus/engine/PapyrusSelectionMenuIcon.java +0 -48
- package/android/src/main/java/com/papyrus/engine/PapyrusTextAnnotationModel.java +0 -22
- package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentView.java +0 -661
- package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentViewManager.java +0 -49
- package/android/src/main/java/com/papyrus/engine/PapyrusTextStore.java +0 -43
- package/ios/PapyrusComicDocumentView.h +0 -21
- package/ios/PapyrusComicDocumentView.m +0 -547
- package/ios/PapyrusComicDocumentViewManager.m +0 -23
- package/ios/PapyrusPageRotationRegistry.h +0 -29
- package/ios/PapyrusPageRotationRegistry.m +0 -179
- package/ios/PapyrusPdfDocumentView.h +0 -55
- package/ios/PapyrusPdfDocumentView.m +0 -2338
- package/ios/PapyrusPdfDocumentViewManager.m +0 -61
- package/ios/PapyrusPdfPageTheme.h +0 -15
- package/ios/PapyrusPdfPageTheme.m +0 -218
- package/ios/PapyrusSelectionMenu.h +0 -27
- package/ios/PapyrusTextAnnotationRange.h +0 -2
- package/ios/PapyrusTextAnnotationRange.m +0 -29
- package/ios/PapyrusTextDocumentView.h +0 -32
- package/ios/PapyrusTextDocumentView.m +0 -518
- package/ios/PapyrusTextDocumentViewManager.m +0 -34
- package/ios/PapyrusTextStore.h +0 -13
- package/ios/PapyrusTextStore.m +0 -73
- package/third_party_licenses/BLAKE2-NOTICE.txt +0 -11
- package/third_party_licenses/libarchive-COPYING +0 -65
- package/vendor/libarchive/PapyrusComicArchive.cpp +0 -376
- package/vendor/libarchive/PapyrusComicArchive.h +0 -30
- package/vendor/libarchive/README.papyrus.md +0 -15
- package/vendor/libarchive/android.h +0 -192
- package/vendor/libarchive/config/PapyrusArchiveConfig.h +0 -71
- package/vendor/libarchive/libarchive/CMakeLists.txt +0 -293
- package/vendor/libarchive/libarchive/android_lf.h +0 -36
- package/vendor/libarchive/libarchive/archive.h +0 -1266
- package/vendor/libarchive/libarchive/archive_acl.c +0 -2025
- package/vendor/libarchive/libarchive/archive_acl_private.h +0 -85
- package/vendor/libarchive/libarchive/archive_blake2.h +0 -197
- package/vendor/libarchive/libarchive/archive_blake2_impl.h +0 -161
- package/vendor/libarchive/libarchive/archive_blake2s_ref.c +0 -369
- package/vendor/libarchive/libarchive/archive_blake2sp_ref.c +0 -361
- package/vendor/libarchive/libarchive/archive_check_magic.c +0 -183
- package/vendor/libarchive/libarchive/archive_cmdline.c +0 -211
- package/vendor/libarchive/libarchive/archive_cmdline_private.h +0 -45
- package/vendor/libarchive/libarchive/archive_crc32.h +0 -123
- package/vendor/libarchive/libarchive/archive_cryptor.c +0 -534
- package/vendor/libarchive/libarchive/archive_cryptor_private.h +0 -199
- package/vendor/libarchive/libarchive/archive_digest.c +0 -1584
- package/vendor/libarchive/libarchive/archive_digest_private.h +0 -431
- package/vendor/libarchive/libarchive/archive_disk_acl_darwin.c +0 -558
- package/vendor/libarchive/libarchive/archive_disk_acl_freebsd.c +0 -712
- package/vendor/libarchive/libarchive/archive_disk_acl_linux.c +0 -760
- package/vendor/libarchive/libarchive/archive_disk_acl_sunos.c +0 -824
- package/vendor/libarchive/libarchive/archive_endian.h +0 -234
- package/vendor/libarchive/libarchive/archive_entry.3 +0 -147
- package/vendor/libarchive/libarchive/archive_entry.c +0 -2297
- package/vendor/libarchive/libarchive/archive_entry.h +0 -763
- package/vendor/libarchive/libarchive/archive_entry_acl.3 +0 -458
- package/vendor/libarchive/libarchive/archive_entry_copy_bhfi.c +0 -55
- package/vendor/libarchive/libarchive/archive_entry_copy_stat.c +0 -82
- package/vendor/libarchive/libarchive/archive_entry_link_resolver.c +0 -472
- package/vendor/libarchive/libarchive/archive_entry_linkify.3 +0 -224
- package/vendor/libarchive/libarchive/archive_entry_locale.h +0 -90
- package/vendor/libarchive/libarchive/archive_entry_misc.3 +0 -63
- package/vendor/libarchive/libarchive/archive_entry_paths.3 +0 -153
- package/vendor/libarchive/libarchive/archive_entry_perms.3 +0 -210
- package/vendor/libarchive/libarchive/archive_entry_private.h +0 -205
- package/vendor/libarchive/libarchive/archive_entry_sparse.c +0 -156
- package/vendor/libarchive/libarchive/archive_entry_stat.3 +0 -274
- package/vendor/libarchive/libarchive/archive_entry_stat.c +0 -121
- package/vendor/libarchive/libarchive/archive_entry_strmode.c +0 -69
- package/vendor/libarchive/libarchive/archive_entry_time.3 +0 -127
- package/vendor/libarchive/libarchive/archive_entry_xattr.c +0 -155
- package/vendor/libarchive/libarchive/archive_hmac.c +0 -345
- package/vendor/libarchive/libarchive/archive_hmac_private.h +0 -119
- package/vendor/libarchive/libarchive/archive_integer.h +0 -267
- package/vendor/libarchive/libarchive/archive_match.c +0 -1869
- package/vendor/libarchive/libarchive/archive_openssl_evp_private.h +0 -54
- package/vendor/libarchive/libarchive/archive_openssl_hmac_private.h +0 -54
- package/vendor/libarchive/libarchive/archive_options.c +0 -219
- package/vendor/libarchive/libarchive/archive_options_private.h +0 -49
- package/vendor/libarchive/libarchive/archive_pack_dev.c +0 -330
- package/vendor/libarchive/libarchive/archive_pack_dev.h +0 -49
- package/vendor/libarchive/libarchive/archive_parse_date.c +0 -1173
- package/vendor/libarchive/libarchive/archive_pathmatch.c +0 -480
- package/vendor/libarchive/libarchive/archive_pathmatch.h +0 -50
- package/vendor/libarchive/libarchive/archive_platform.h +0 -213
- package/vendor/libarchive/libarchive/archive_platform_acl.h +0 -53
- package/vendor/libarchive/libarchive/archive_platform_stat.h +0 -45
- package/vendor/libarchive/libarchive/archive_platform_xattr.h +0 -45
- package/vendor/libarchive/libarchive/archive_ppmd7.c +0 -1173
- package/vendor/libarchive/libarchive/archive_ppmd7_private.h +0 -119
- package/vendor/libarchive/libarchive/archive_ppmd8.c +0 -1293
- package/vendor/libarchive/libarchive/archive_ppmd8_private.h +0 -123
- package/vendor/libarchive/libarchive/archive_ppmd_private.h +0 -159
- package/vendor/libarchive/libarchive/archive_private.h +0 -209
- package/vendor/libarchive/libarchive/archive_random.c +0 -274
- package/vendor/libarchive/libarchive/archive_random_private.h +0 -36
- package/vendor/libarchive/libarchive/archive_rb.c +0 -709
- package/vendor/libarchive/libarchive/archive_rb.h +0 -113
- package/vendor/libarchive/libarchive/archive_read.3 +0 -250
- package/vendor/libarchive/libarchive/archive_read.c +0 -1814
- package/vendor/libarchive/libarchive/archive_read_add_passphrase.3 +0 -72
- package/vendor/libarchive/libarchive/archive_read_add_passphrase.c +0 -189
- package/vendor/libarchive/libarchive/archive_read_append_filter.c +0 -209
- package/vendor/libarchive/libarchive/archive_read_data.3 +0 -128
- package/vendor/libarchive/libarchive/archive_read_data_into_fd.c +0 -207
- package/vendor/libarchive/libarchive/archive_read_disk.3 +0 -422
- package/vendor/libarchive/libarchive/archive_read_disk_entry_from_file.c +0 -1086
- package/vendor/libarchive/libarchive/archive_read_disk_posix.c +0 -2639
- package/vendor/libarchive/libarchive/archive_read_disk_private.h +0 -97
- package/vendor/libarchive/libarchive/archive_read_disk_set_standard_lookup.c +0 -315
- package/vendor/libarchive/libarchive/archive_read_disk_windows.c +0 -2603
- package/vendor/libarchive/libarchive/archive_read_extract.3 +0 -135
- package/vendor/libarchive/libarchive/archive_read_extract.c +0 -59
- package/vendor/libarchive/libarchive/archive_read_extract2.c +0 -154
- package/vendor/libarchive/libarchive/archive_read_filter.3 +0 -163
- package/vendor/libarchive/libarchive/archive_read_format.3 +0 -190
- package/vendor/libarchive/libarchive/archive_read_free.3 +0 -91
- package/vendor/libarchive/libarchive/archive_read_header.3 +0 -89
- package/vendor/libarchive/libarchive/archive_read_new.3 +0 -57
- package/vendor/libarchive/libarchive/archive_read_open.3 +0 -247
- package/vendor/libarchive/libarchive/archive_read_open_fd.c +0 -236
- package/vendor/libarchive/libarchive/archive_read_open_file.c +0 -257
- package/vendor/libarchive/libarchive/archive_read_open_filename.c +0 -652
- package/vendor/libarchive/libarchive/archive_read_open_memory.c +0 -188
- package/vendor/libarchive/libarchive/archive_read_private.h +0 -274
- package/vendor/libarchive/libarchive/archive_read_set_format.c +0 -116
- package/vendor/libarchive/libarchive/archive_read_set_options.3 +0 -290
- package/vendor/libarchive/libarchive/archive_read_set_options.c +0 -132
- package/vendor/libarchive/libarchive/archive_read_support_filter_all.c +0 -84
- package/vendor/libarchive/libarchive/archive_read_support_filter_by_code.c +0 -68
- package/vendor/libarchive/libarchive/archive_read_support_filter_bzip2.c +0 -360
- package/vendor/libarchive/libarchive/archive_read_support_filter_compress.c +0 -457
- package/vendor/libarchive/libarchive/archive_read_support_filter_grzip.c +0 -108
- package/vendor/libarchive/libarchive/archive_read_support_filter_gzip.c +0 -538
- package/vendor/libarchive/libarchive/archive_read_support_filter_lrzip.c +0 -119
- package/vendor/libarchive/libarchive/archive_read_support_filter_lz4.c +0 -829
- package/vendor/libarchive/libarchive/archive_read_support_filter_lzop.c +0 -493
- package/vendor/libarchive/libarchive/archive_read_support_filter_none.c +0 -51
- package/vendor/libarchive/libarchive/archive_read_support_filter_program.c +0 -497
- package/vendor/libarchive/libarchive/archive_read_support_filter_rpm.c +0 -249
- package/vendor/libarchive/libarchive/archive_read_support_filter_uu.c +0 -739
- package/vendor/libarchive/libarchive/archive_read_support_filter_xz.c +0 -792
- package/vendor/libarchive/libarchive/archive_read_support_filter_zstd.c +0 -356
- package/vendor/libarchive/libarchive/archive_read_support_format_7zip.c +0 -4650
- package/vendor/libarchive/libarchive/archive_read_support_format_all.c +0 -88
- package/vendor/libarchive/libarchive/archive_read_support_format_ar.c +0 -597
- package/vendor/libarchive/libarchive/archive_read_support_format_by_code.c +0 -76
- package/vendor/libarchive/libarchive/archive_read_support_format_cab.c +0 -3410
- package/vendor/libarchive/libarchive/archive_read_support_format_cpio.c +0 -1152
- package/vendor/libarchive/libarchive/archive_read_support_format_empty.c +0 -95
- package/vendor/libarchive/libarchive/archive_read_support_format_iso9660.c +0 -3516
- package/vendor/libarchive/libarchive/archive_read_support_format_lha.c +0 -2931
- package/vendor/libarchive/libarchive/archive_read_support_format_mtree.c +0 -2113
- package/vendor/libarchive/libarchive/archive_read_support_format_rar.c +0 -3932
- package/vendor/libarchive/libarchive/archive_read_support_format_rar5.c +0 -4501
- package/vendor/libarchive/libarchive/archive_read_support_format_raw.c +0 -194
- package/vendor/libarchive/libarchive/archive_read_support_format_tar.c +0 -3785
- package/vendor/libarchive/libarchive/archive_read_support_format_warc.c +0 -875
- package/vendor/libarchive/libarchive/archive_read_support_format_xar.c +0 -3770
- package/vendor/libarchive/libarchive/archive_read_support_format_zip.c +0 -4710
- package/vendor/libarchive/libarchive/archive_string.c +0 -4391
- package/vendor/libarchive/libarchive/archive_string.h +0 -244
- package/vendor/libarchive/libarchive/archive_string_composition.h +0 -2289
- package/vendor/libarchive/libarchive/archive_string_sprintf.c +0 -200
- package/vendor/libarchive/libarchive/archive_time.c +0 -168
- package/vendor/libarchive/libarchive/archive_time_private.h +0 -47
- package/vendor/libarchive/libarchive/archive_util.3 +0 -239
- package/vendor/libarchive/libarchive/archive_util.c +0 -668
- package/vendor/libarchive/libarchive/archive_version_details.c +0 -516
- package/vendor/libarchive/libarchive/archive_virtual.c +0 -162
- package/vendor/libarchive/libarchive/archive_windows.c +0 -1035
- package/vendor/libarchive/libarchive/archive_windows.h +0 -332
- package/vendor/libarchive/libarchive/archive_write.3 +0 -266
- package/vendor/libarchive/libarchive/archive_write.c +0 -896
- package/vendor/libarchive/libarchive/archive_write_add_filter.c +0 -71
- package/vendor/libarchive/libarchive/archive_write_add_filter_b64encode.c +0 -329
- package/vendor/libarchive/libarchive/archive_write_add_filter_by_name.c +0 -76
- package/vendor/libarchive/libarchive/archive_write_add_filter_bzip2.c +0 -411
- package/vendor/libarchive/libarchive/archive_write_add_filter_compress.c +0 -459
- package/vendor/libarchive/libarchive/archive_write_add_filter_grzip.c +0 -143
- package/vendor/libarchive/libarchive/archive_write_add_filter_gzip.c +0 -493
- package/vendor/libarchive/libarchive/archive_write_add_filter_lrzip.c +0 -214
- package/vendor/libarchive/libarchive/archive_write_add_filter_lz4.c +0 -710
- package/vendor/libarchive/libarchive/archive_write_add_filter_lzop.c +0 -500
- package/vendor/libarchive/libarchive/archive_write_add_filter_none.c +0 -42
- package/vendor/libarchive/libarchive/archive_write_add_filter_program.c +0 -398
- package/vendor/libarchive/libarchive/archive_write_add_filter_uuencode.c +0 -320
- package/vendor/libarchive/libarchive/archive_write_add_filter_xz.c +0 -547
- package/vendor/libarchive/libarchive/archive_write_add_filter_zstd.c +0 -608
- package/vendor/libarchive/libarchive/archive_write_blocksize.3 +0 -112
- package/vendor/libarchive/libarchive/archive_write_data.3 +0 -88
- package/vendor/libarchive/libarchive/archive_write_disk.3 +0 -360
- package/vendor/libarchive/libarchive/archive_write_disk_posix.c +0 -4789
- package/vendor/libarchive/libarchive/archive_write_disk_private.h +0 -43
- package/vendor/libarchive/libarchive/archive_write_disk_set_standard_lookup.c +0 -265
- package/vendor/libarchive/libarchive/archive_write_disk_windows.c +0 -2952
- package/vendor/libarchive/libarchive/archive_write_filter.3 +0 -140
- package/vendor/libarchive/libarchive/archive_write_finish_entry.3 +0 -77
- package/vendor/libarchive/libarchive/archive_write_format.3 +0 -187
- package/vendor/libarchive/libarchive/archive_write_free.3 +0 -94
- package/vendor/libarchive/libarchive/archive_write_header.3 +0 -71
- package/vendor/libarchive/libarchive/archive_write_new.3 +0 -56
- package/vendor/libarchive/libarchive/archive_write_open.3 +0 -270
- package/vendor/libarchive/libarchive/archive_write_open_fd.c +0 -141
- package/vendor/libarchive/libarchive/archive_write_open_file.c +0 -102
- package/vendor/libarchive/libarchive/archive_write_open_filename.c +0 -272
- package/vendor/libarchive/libarchive/archive_write_open_memory.c +0 -110
- package/vendor/libarchive/libarchive/archive_write_private.h +0 -166
- package/vendor/libarchive/libarchive/archive_write_set_format.c +0 -124
- package/vendor/libarchive/libarchive/archive_write_set_format_7zip.c +0 -2571
- package/vendor/libarchive/libarchive/archive_write_set_format_ar.c +0 -540
- package/vendor/libarchive/libarchive/archive_write_set_format_by_name.c +0 -93
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio.c +0 -11
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_binary.c +0 -618
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_newc.c +0 -457
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_odc.c +0 -508
- package/vendor/libarchive/libarchive/archive_write_set_format_filter_by_ext.c +0 -141
- package/vendor/libarchive/libarchive/archive_write_set_format_gnutar.c +0 -790
- package/vendor/libarchive/libarchive/archive_write_set_format_iso9660.c +0 -8216
- package/vendor/libarchive/libarchive/archive_write_set_format_mtree.c +0 -2307
- package/vendor/libarchive/libarchive/archive_write_set_format_pax.c +0 -2249
- package/vendor/libarchive/libarchive/archive_write_set_format_private.h +0 -40
- package/vendor/libarchive/libarchive/archive_write_set_format_raw.c +0 -123
- package/vendor/libarchive/libarchive/archive_write_set_format_shar.c +0 -650
- package/vendor/libarchive/libarchive/archive_write_set_format_ustar.c +0 -768
- package/vendor/libarchive/libarchive/archive_write_set_format_v7tar.c +0 -648
- package/vendor/libarchive/libarchive/archive_write_set_format_warc.c +0 -491
- package/vendor/libarchive/libarchive/archive_write_set_format_xar.c +0 -3799
- package/vendor/libarchive/libarchive/archive_write_set_format_zip.c +0 -2548
- package/vendor/libarchive/libarchive/archive_write_set_options.3 +0 -779
- package/vendor/libarchive/libarchive/archive_write_set_options.c +0 -129
- package/vendor/libarchive/libarchive/archive_write_set_passphrase.3 +0 -72
- package/vendor/libarchive/libarchive/archive_write_set_passphrase.c +0 -95
- package/vendor/libarchive/libarchive/archive_xxhash.h +0 -48
- package/vendor/libarchive/libarchive/config_freebsd.h +0 -275
- package/vendor/libarchive/libarchive/cpio.5 +0 -389
- package/vendor/libarchive/libarchive/filter_fork.h +0 -44
- package/vendor/libarchive/libarchive/filter_fork_posix.c +0 -269
- package/vendor/libarchive/libarchive/filter_fork_windows.c +0 -270
- package/vendor/libarchive/libarchive/libarchive-formats.5 +0 -478
- package/vendor/libarchive/libarchive/libarchive.3 +0 -297
- package/vendor/libarchive/libarchive/libarchive_changes.3 +0 -339
- package/vendor/libarchive/libarchive/libarchive_internals.3 +0 -363
- package/vendor/libarchive/libarchive/module.modulemap +0 -34
- package/vendor/libarchive/libarchive/mtree.5 +0 -323
- package/vendor/libarchive/libarchive/tar.5 +0 -947
- package/vendor/libarchive/libarchive/xxhash.c +0 -531
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
/*-
|
|
2
|
-
* Copyright (c) 2009-2011 Michihiro NAKAJIMA
|
|
3
|
-
* Copyright (c) 2003-2006 Tim Kientzle
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
*
|
|
6
|
-
* Redistribution and use in source and binary forms, with or without
|
|
7
|
-
* modification, are permitted provided that the following conditions
|
|
8
|
-
* are met:
|
|
9
|
-
* 1. Redistributions of source code must retain the above copyright
|
|
10
|
-
* notice, this list of conditions and the following disclaimer
|
|
11
|
-
* in this position and unchanged.
|
|
12
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
|
13
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
14
|
-
* documentation and/or other materials provided with the distribution.
|
|
15
|
-
*
|
|
16
|
-
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
|
17
|
-
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
18
|
-
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
19
|
-
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
20
|
-
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
21
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
22
|
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
23
|
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
24
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
25
|
-
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/*
|
|
29
|
-
* TODO: A lot of stuff in here isn't actually used by libarchive and
|
|
30
|
-
* can be trimmed out. Note that this file is used by libarchive and
|
|
31
|
-
* libarchive_test but nowhere else. (But note that it gets compiled
|
|
32
|
-
* with many different Windows environments, including MinGW, Visual
|
|
33
|
-
* Studio, and Cygwin. Significant changes should be tested in all three.)
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
/*
|
|
37
|
-
* TODO: Don't use off_t in here. Use __int64 instead. Note that
|
|
38
|
-
* Visual Studio and the Windows SDK define off_t as 32 bits; Win32's
|
|
39
|
-
* more modern file handling APIs all use __int64 instead of off_t.
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
#ifndef LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED
|
|
43
|
-
#define LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED
|
|
44
|
-
|
|
45
|
-
#ifndef __LIBARCHIVE_BUILD
|
|
46
|
-
#error This header is only to be used internally to libarchive.
|
|
47
|
-
#endif
|
|
48
|
-
|
|
49
|
-
/* Start of configuration for native Win32 */
|
|
50
|
-
#ifndef MINGW_HAS_SECURE_API
|
|
51
|
-
#define MINGW_HAS_SECURE_API 1
|
|
52
|
-
#endif
|
|
53
|
-
|
|
54
|
-
#include <errno.h>
|
|
55
|
-
#define set_errno(val) ((errno)=val)
|
|
56
|
-
#include <io.h>
|
|
57
|
-
#include <stdlib.h> //brings in NULL
|
|
58
|
-
#if defined(HAVE_STDINT_H)
|
|
59
|
-
#include <stdint.h>
|
|
60
|
-
#endif
|
|
61
|
-
#include <stdio.h>
|
|
62
|
-
#include <fcntl.h>
|
|
63
|
-
#include <sys/stat.h>
|
|
64
|
-
#include <process.h>
|
|
65
|
-
#include <direct.h>
|
|
66
|
-
#if defined(__MINGW32__) && defined(HAVE_UNISTD_H)
|
|
67
|
-
/* Prevent build error from a type mismatch of ftruncate().
|
|
68
|
-
* This unistd.h defines it as ftruncate(int, off_t). */
|
|
69
|
-
#include <unistd.h>
|
|
70
|
-
#endif
|
|
71
|
-
#define NOCRYPT
|
|
72
|
-
#include <windows.h>
|
|
73
|
-
//#define EFTYPE 7
|
|
74
|
-
|
|
75
|
-
#include "archive_platform_stat.h"
|
|
76
|
-
|
|
77
|
-
#if defined(__BORLANDC__)
|
|
78
|
-
#pragma warn -8068 /* Constant out of range in comparison. */
|
|
79
|
-
#pragma warn -8072 /* Suspicious pointer arithmetic. */
|
|
80
|
-
#endif
|
|
81
|
-
|
|
82
|
-
#ifndef NULL
|
|
83
|
-
#ifdef __cplusplus
|
|
84
|
-
#define NULL 0
|
|
85
|
-
#else
|
|
86
|
-
#define NULL ((void *)0)
|
|
87
|
-
#endif
|
|
88
|
-
#endif
|
|
89
|
-
|
|
90
|
-
/* Alias the Windows _function to the POSIX equivalent. */
|
|
91
|
-
#define close _close
|
|
92
|
-
#define fcntl(fd, cmd, flg) /* No operation. */
|
|
93
|
-
#ifndef fileno
|
|
94
|
-
#define fileno _fileno
|
|
95
|
-
#endif
|
|
96
|
-
#ifdef fstat
|
|
97
|
-
#undef fstat
|
|
98
|
-
#endif
|
|
99
|
-
#define fstat __la_fstat
|
|
100
|
-
#if !defined(__BORLANDC__)
|
|
101
|
-
#ifdef lseek
|
|
102
|
-
#undef lseek
|
|
103
|
-
#endif
|
|
104
|
-
#define lseek _lseeki64
|
|
105
|
-
#else
|
|
106
|
-
#define lseek __la_lseek
|
|
107
|
-
#define __LA_LSEEK_NEEDED
|
|
108
|
-
#endif
|
|
109
|
-
#define lstat __la_stat
|
|
110
|
-
#define open __la_open
|
|
111
|
-
#define _wopen __la_wopen
|
|
112
|
-
#define read __la_read
|
|
113
|
-
#if !defined(__BORLANDC__) && !defined(__WATCOMC__)
|
|
114
|
-
#define setmode _setmode
|
|
115
|
-
#endif
|
|
116
|
-
#define la_stat(path,stref) __la_stat(path,stref)
|
|
117
|
-
#if !defined(__WATCOMC__)
|
|
118
|
-
#if !defined(__BORLANDC__)
|
|
119
|
-
#define strdup _strdup
|
|
120
|
-
#endif
|
|
121
|
-
#define tzset _tzset
|
|
122
|
-
#if !defined(__BORLANDC__)
|
|
123
|
-
#define umask _umask
|
|
124
|
-
#endif
|
|
125
|
-
#endif
|
|
126
|
-
#define waitpid __la_waitpid
|
|
127
|
-
#define write __la_write
|
|
128
|
-
|
|
129
|
-
#if !defined(__WATCOMC__)
|
|
130
|
-
|
|
131
|
-
#ifndef O_RDONLY
|
|
132
|
-
#define O_RDONLY _O_RDONLY
|
|
133
|
-
#define O_WRONLY _O_WRONLY
|
|
134
|
-
#define O_TRUNC _O_TRUNC
|
|
135
|
-
#define O_CREAT _O_CREAT
|
|
136
|
-
#define O_EXCL _O_EXCL
|
|
137
|
-
#define O_BINARY _O_BINARY
|
|
138
|
-
#endif
|
|
139
|
-
|
|
140
|
-
#ifndef _S_IFIFO
|
|
141
|
-
#define _S_IFIFO 0010000 /* pipe */
|
|
142
|
-
#endif
|
|
143
|
-
#ifndef _S_IFCHR
|
|
144
|
-
#define _S_IFCHR 0020000 /* character special */
|
|
145
|
-
#endif
|
|
146
|
-
#ifndef _S_IFDIR
|
|
147
|
-
#define _S_IFDIR 0040000 /* directory */
|
|
148
|
-
#endif
|
|
149
|
-
#ifndef _S_IFBLK
|
|
150
|
-
#define _S_IFBLK 0060000 /* block special */
|
|
151
|
-
#endif
|
|
152
|
-
#ifndef _S_IFLNK
|
|
153
|
-
#define _S_IFLNK 0120000 /* symbolic link */
|
|
154
|
-
#endif
|
|
155
|
-
#ifndef _S_IFSOCK
|
|
156
|
-
#define _S_IFSOCK 0140000 /* socket */
|
|
157
|
-
#endif
|
|
158
|
-
#ifndef _S_IFREG
|
|
159
|
-
#define _S_IFREG 0100000 /* regular */
|
|
160
|
-
#endif
|
|
161
|
-
#ifndef _S_IFMT
|
|
162
|
-
#define _S_IFMT 0170000 /* file type mask */
|
|
163
|
-
#endif
|
|
164
|
-
|
|
165
|
-
#ifndef S_IFIFO
|
|
166
|
-
#define S_IFIFO _S_IFIFO
|
|
167
|
-
#endif
|
|
168
|
-
//#define S_IFCHR _S_IFCHR
|
|
169
|
-
//#define S_IFDIR _S_IFDIR
|
|
170
|
-
#ifndef S_IFBLK
|
|
171
|
-
#define S_IFBLK _S_IFBLK
|
|
172
|
-
#endif
|
|
173
|
-
#ifndef S_IFLNK
|
|
174
|
-
#define S_IFLNK _S_IFLNK
|
|
175
|
-
#endif
|
|
176
|
-
#ifndef S_IFSOCK
|
|
177
|
-
#define S_IFSOCK _S_IFSOCK
|
|
178
|
-
#endif
|
|
179
|
-
//#define S_IFREG _S_IFREG
|
|
180
|
-
//#define S_IFMT _S_IFMT
|
|
181
|
-
|
|
182
|
-
#ifndef S_ISBLK
|
|
183
|
-
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* block special */
|
|
184
|
-
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo or socket */
|
|
185
|
-
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* char special */
|
|
186
|
-
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */
|
|
187
|
-
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */
|
|
188
|
-
#endif
|
|
189
|
-
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* Symbolic link */
|
|
190
|
-
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) /* Socket */
|
|
191
|
-
|
|
192
|
-
#define _S_ISUID 0004000 /* set user id on execution */
|
|
193
|
-
#define _S_ISGID 0002000 /* set group id on execution */
|
|
194
|
-
#define _S_ISVTX 0001000 /* save swapped text even after use */
|
|
195
|
-
|
|
196
|
-
#define S_ISUID _S_ISUID
|
|
197
|
-
#define S_ISGID _S_ISGID
|
|
198
|
-
#define S_ISVTX _S_ISVTX
|
|
199
|
-
|
|
200
|
-
#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
|
|
201
|
-
#define _S_IXUSR _S_IEXEC /* read permission, user */
|
|
202
|
-
#define _S_IWUSR _S_IWRITE /* write permission, user */
|
|
203
|
-
#define _S_IRUSR _S_IREAD /* execute/search permission, user */
|
|
204
|
-
#define _S_IRWXG (_S_IRWXU >> 3)
|
|
205
|
-
#define _S_IXGRP (_S_IXUSR >> 3) /* read permission, group */
|
|
206
|
-
#define _S_IWGRP (_S_IWUSR >> 3) /* write permission, group */
|
|
207
|
-
#define _S_IRGRP (_S_IRUSR >> 3) /* execute/search permission, group */
|
|
208
|
-
#define _S_IRWXO (_S_IRWXG >> 3)
|
|
209
|
-
#define _S_IXOTH (_S_IXGRP >> 3) /* read permission, other */
|
|
210
|
-
#define _S_IWOTH (_S_IWGRP >> 3) /* write permission, other */
|
|
211
|
-
#define _S_IROTH (_S_IRGRP >> 3) /* execute/search permission, other */
|
|
212
|
-
|
|
213
|
-
#ifndef S_IRWXU
|
|
214
|
-
#define S_IRWXU _S_IRWXU
|
|
215
|
-
#define S_IXUSR _S_IXUSR
|
|
216
|
-
#define S_IWUSR _S_IWUSR
|
|
217
|
-
#define S_IRUSR _S_IRUSR
|
|
218
|
-
#endif
|
|
219
|
-
#ifndef S_IRWXG
|
|
220
|
-
#define S_IRWXG _S_IRWXG
|
|
221
|
-
#define S_IXGRP _S_IXGRP
|
|
222
|
-
#define S_IWGRP _S_IWGRP
|
|
223
|
-
#endif
|
|
224
|
-
#ifndef S_IRGRP
|
|
225
|
-
#define S_IRGRP _S_IRGRP
|
|
226
|
-
#endif
|
|
227
|
-
#ifndef S_IRWXO
|
|
228
|
-
#define S_IRWXO _S_IRWXO
|
|
229
|
-
#define S_IXOTH _S_IXOTH
|
|
230
|
-
#define S_IWOTH _S_IWOTH
|
|
231
|
-
#define S_IROTH _S_IROTH
|
|
232
|
-
#endif
|
|
233
|
-
|
|
234
|
-
#endif
|
|
235
|
-
|
|
236
|
-
#define F_DUPFD 0 /* Duplicate file descriptor. */
|
|
237
|
-
#define F_GETFD 1 /* Get file descriptor flags. */
|
|
238
|
-
#define F_SETFD 2 /* Set file descriptor flags. */
|
|
239
|
-
#define F_GETFL 3 /* Get file status flags. */
|
|
240
|
-
#define F_SETFL 4 /* Set file status flags. */
|
|
241
|
-
#define F_GETOWN 5 /* Get owner (receiver of SIGIO). */
|
|
242
|
-
#define F_SETOWN 6 /* Set owner (receiver of SIGIO). */
|
|
243
|
-
#define F_GETLK 7 /* Get record locking info. */
|
|
244
|
-
#define F_SETLK 8 /* Set record locking info (non-blocking). */
|
|
245
|
-
#define F_SETLKW 9 /* Set record locking info (blocking). */
|
|
246
|
-
|
|
247
|
-
/* XXX missing */
|
|
248
|
-
#define F_GETLK64 7 /* Get record locking info. */
|
|
249
|
-
#define F_SETLK64 8 /* Set record locking info (non-blocking). */
|
|
250
|
-
#define F_SETLKW64 9 /* Set record locking info (blocking). */
|
|
251
|
-
|
|
252
|
-
/* File descriptor flags used with F_GETFD and F_SETFD. */
|
|
253
|
-
#define FD_CLOEXEC 1 /* Close on exec. */
|
|
254
|
-
|
|
255
|
-
//NOT SURE IF O_NONBLOCK is OK here but at least the 0x0004 flag is not used by anything else...
|
|
256
|
-
#define O_NONBLOCK 0x0004 /* Non-blocking I/O. */
|
|
257
|
-
//#define O_NDELAY O_NONBLOCK
|
|
258
|
-
|
|
259
|
-
/* Symbolic constants for the access() function */
|
|
260
|
-
#if !defined(F_OK)
|
|
261
|
-
#define R_OK 4 /* Test for read permission */
|
|
262
|
-
#define W_OK 2 /* Test for write permission */
|
|
263
|
-
#define X_OK 1 /* Test for execute permission */
|
|
264
|
-
#define F_OK 0 /* Test for existence of file */
|
|
265
|
-
#endif
|
|
266
|
-
|
|
267
|
-
/* Functions to circumvent off_t limitations */
|
|
268
|
-
int __la_seek_fstat(int fd, la_seek_stat_t *st);
|
|
269
|
-
int __la_seek_stat(const char *path, la_seek_stat_t *st);
|
|
270
|
-
|
|
271
|
-
/* Replacement POSIX function */
|
|
272
|
-
extern int __la_fstat(int fd, struct stat *st);
|
|
273
|
-
extern int __la_lstat(const char *path, struct stat *st);
|
|
274
|
-
#if defined(__LA_LSEEK_NEEDED)
|
|
275
|
-
extern __int64 __la_lseek(int fd, __int64 offset, int whence);
|
|
276
|
-
#endif
|
|
277
|
-
extern int __la_open(const char *path, int flags, ...);
|
|
278
|
-
extern int __la_wopen(const wchar_t *path, int flags, ...);
|
|
279
|
-
extern ssize_t __la_read(int fd, void *buf, size_t nbytes);
|
|
280
|
-
extern int __la_stat(const char *path, struct stat *st);
|
|
281
|
-
extern pid_t __la_waitpid(HANDLE child, int *status, int option);
|
|
282
|
-
extern ssize_t __la_write(int fd, const void *buf, size_t nbytes);
|
|
283
|
-
|
|
284
|
-
#define _stat64i32(path, st) __la_stat(path, st)
|
|
285
|
-
#define _stat64(path, st) __la_stat(path, st)
|
|
286
|
-
/* for status returned by la_waitpid */
|
|
287
|
-
#define WIFEXITED(sts) ((sts & 0x100) == 0)
|
|
288
|
-
#define WEXITSTATUS(sts) (sts & 0x0FF)
|
|
289
|
-
|
|
290
|
-
extern wchar_t *__la_win_permissive_name(const char *name);
|
|
291
|
-
extern wchar_t *__la_win_permissive_name_w(const wchar_t *wname);
|
|
292
|
-
extern void __la_dosmaperr(unsigned long e);
|
|
293
|
-
#define la_dosmaperr(e) __la_dosmaperr(e)
|
|
294
|
-
extern struct archive_entry *__la_win_entry_in_posix_pathseparator(
|
|
295
|
-
struct archive_entry *);
|
|
296
|
-
|
|
297
|
-
#if defined(HAVE_WCRTOMB) && defined(__BORLANDC__)
|
|
298
|
-
typedef int mbstate_t;
|
|
299
|
-
size_t wcrtomb(char *, wchar_t, mbstate_t *);
|
|
300
|
-
#endif
|
|
301
|
-
|
|
302
|
-
#ifndef WINAPI_FAMILY_PARTITION
|
|
303
|
-
#define WINAPI_FAMILY_PARTITION(x) (x)
|
|
304
|
-
#endif
|
|
305
|
-
|
|
306
|
-
#ifndef WINAPI_PARTITION_DESKTOP
|
|
307
|
-
#define WINAPI_PARTITION_DESKTOP 1
|
|
308
|
-
#endif
|
|
309
|
-
|
|
310
|
-
#ifndef WINAPI_PARTITION_SYSTEM
|
|
311
|
-
#define WINAPI_PARTITION_SYSTEM 1
|
|
312
|
-
#endif
|
|
313
|
-
|
|
314
|
-
#ifndef NTDDI_VERSION
|
|
315
|
-
#define NTDDI_VERSION 0x05020000
|
|
316
|
-
#endif
|
|
317
|
-
|
|
318
|
-
#ifndef NTDDI_WIN10_VB
|
|
319
|
-
#define NTDDI_WIN10_VB 0x0A000008
|
|
320
|
-
#endif
|
|
321
|
-
|
|
322
|
-
#if !WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) && NTDDI_VERSION < NTDDI_WIN10_VB
|
|
323
|
-
// not supported in UWP SDK before 20H1
|
|
324
|
-
#define GetVolumePathNameW(f, v, c) (0)
|
|
325
|
-
#elif defined(_MSC_VER) && _MSC_VER < 1300
|
|
326
|
-
WINBASEAPI BOOL WINAPI GetVolumePathNameW(
|
|
327
|
-
LPCWSTR lpszFileName,
|
|
328
|
-
LPWSTR lpszVolumePathName,
|
|
329
|
-
DWORD cchBufferLength
|
|
330
|
-
);
|
|
331
|
-
#endif
|
|
332
|
-
#endif /* !LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED */
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
.\" Copyright (c) 2003-2011 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_WRITE 3
|
|
27
|
-
.Os
|
|
28
|
-
.Sh NAME
|
|
29
|
-
.Nm archive_write
|
|
30
|
-
.Nd functions for creating archives
|
|
31
|
-
.Sh LIBRARY
|
|
32
|
-
Streaming Archive Library (libarchive, -larchive)
|
|
33
|
-
.Sh SYNOPSIS
|
|
34
|
-
.In archive.h
|
|
35
|
-
.Sh DESCRIPTION
|
|
36
|
-
These functions provide a complete API for creating streaming
|
|
37
|
-
archive files.
|
|
38
|
-
The general process is to first create the
|
|
39
|
-
.Tn struct archive
|
|
40
|
-
object, set any desired options, initialize the archive, append entries, then
|
|
41
|
-
close the archive and release all resources.
|
|
42
|
-
.\"
|
|
43
|
-
.Ss Create archive object
|
|
44
|
-
See
|
|
45
|
-
.Xr archive_write_new 3 .
|
|
46
|
-
.Pp
|
|
47
|
-
To write an archive, you must first obtain an initialized
|
|
48
|
-
.Tn struct archive
|
|
49
|
-
object from
|
|
50
|
-
.Fn archive_write_new .
|
|
51
|
-
.\"
|
|
52
|
-
.Ss Enable filters and formats, configure block size and padding
|
|
53
|
-
See
|
|
54
|
-
.Xr archive_write_filter 3 ,
|
|
55
|
-
.Xr archive_write_format 3
|
|
56
|
-
and
|
|
57
|
-
.Xr archive_write_blocksize 3 .
|
|
58
|
-
.Pp
|
|
59
|
-
You can then modify this object for the desired operations with the
|
|
60
|
-
various
|
|
61
|
-
.Fn archive_write_set_XXX
|
|
62
|
-
functions.
|
|
63
|
-
In particular, you will need to invoke appropriate
|
|
64
|
-
.Fn archive_write_add_XXX
|
|
65
|
-
and
|
|
66
|
-
.Fn archive_write_set_XXX
|
|
67
|
-
functions to enable the corresponding compression and format
|
|
68
|
-
support.
|
|
69
|
-
.\"
|
|
70
|
-
.Ss Set options
|
|
71
|
-
See
|
|
72
|
-
.Xr archive_write_set_options 3 .
|
|
73
|
-
.\"
|
|
74
|
-
.Ss Open archive
|
|
75
|
-
See
|
|
76
|
-
.Xr archive_write_open 3 .
|
|
77
|
-
.Pp
|
|
78
|
-
Once you have prepared the
|
|
79
|
-
.Tn struct archive
|
|
80
|
-
object, you call
|
|
81
|
-
.Fn archive_write_open
|
|
82
|
-
to actually open the archive and prepare it for writing.
|
|
83
|
-
There are several variants of this function;
|
|
84
|
-
the most basic expects you to provide pointers to several
|
|
85
|
-
functions that can provide blocks of bytes from the archive.
|
|
86
|
-
There are convenience forms that allow you to
|
|
87
|
-
specify a filename, file descriptor,
|
|
88
|
-
.Ft "FILE *"
|
|
89
|
-
object, or a block of memory from which to write the archive data.
|
|
90
|
-
.\"
|
|
91
|
-
.Ss Produce archive
|
|
92
|
-
See
|
|
93
|
-
.Xr archive_write_header 3
|
|
94
|
-
and
|
|
95
|
-
.Xr archive_write_data 3 .
|
|
96
|
-
.Pp
|
|
97
|
-
Individual archive entries are written in a three-step
|
|
98
|
-
process:
|
|
99
|
-
You first initialize a
|
|
100
|
-
.Tn struct archive_entry
|
|
101
|
-
structure with information about the new entry.
|
|
102
|
-
At a minimum, you should set the pathname of the
|
|
103
|
-
entry and provide a
|
|
104
|
-
.Va struct stat
|
|
105
|
-
with a valid
|
|
106
|
-
.Va st_mode
|
|
107
|
-
field, which specifies the type of object and
|
|
108
|
-
.Va st_size
|
|
109
|
-
field, which specifies the size of the data portion of the object.
|
|
110
|
-
.\"
|
|
111
|
-
.Ss Release resources
|
|
112
|
-
See
|
|
113
|
-
.Xr archive_write_free 3 .
|
|
114
|
-
.Pp
|
|
115
|
-
After all entries have been written, use the
|
|
116
|
-
.Fn archive_write_free
|
|
117
|
-
function to release all resources.
|
|
118
|
-
.\"
|
|
119
|
-
.Sh EXAMPLES
|
|
120
|
-
The following sketch illustrates basic usage of the library.
|
|
121
|
-
In this example,
|
|
122
|
-
the callback functions are simply wrappers around the standard
|
|
123
|
-
.Xr open 2 ,
|
|
124
|
-
.Xr write 2 ,
|
|
125
|
-
and
|
|
126
|
-
.Xr close 2
|
|
127
|
-
system calls.
|
|
128
|
-
.Bd -literal -offset indent
|
|
129
|
-
#ifdef __linux__
|
|
130
|
-
#define _FILE_OFFSET_BITS 64
|
|
131
|
-
#endif
|
|
132
|
-
#include <sys/stat.h>
|
|
133
|
-
#include <archive.h>
|
|
134
|
-
#include <archive_entry.h>
|
|
135
|
-
#include <fcntl.h>
|
|
136
|
-
#include <stdlib.h>
|
|
137
|
-
#include <unistd.h>
|
|
138
|
-
|
|
139
|
-
struct mydata {
|
|
140
|
-
const char *name;
|
|
141
|
-
int fd;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
int
|
|
145
|
-
myopen(struct archive *a, void *client_data)
|
|
146
|
-
{
|
|
147
|
-
struct mydata *mydata = client_data;
|
|
148
|
-
|
|
149
|
-
mydata->fd = open(mydata->name, O_WRONLY | O_CREAT, 0644);
|
|
150
|
-
if (mydata->fd >= 0)
|
|
151
|
-
return (ARCHIVE_OK);
|
|
152
|
-
else
|
|
153
|
-
return (ARCHIVE_FATAL);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
la_ssize_t
|
|
157
|
-
mywrite(struct archive *a, void *client_data, const void *buff, size_t n)
|
|
158
|
-
{
|
|
159
|
-
struct mydata *mydata = client_data;
|
|
160
|
-
|
|
161
|
-
return (write(mydata->fd, buff, n));
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
int
|
|
165
|
-
myclose(struct archive *a, void *client_data)
|
|
166
|
-
{
|
|
167
|
-
struct mydata *mydata = client_data;
|
|
168
|
-
|
|
169
|
-
if (mydata->fd > 0)
|
|
170
|
-
close(mydata->fd);
|
|
171
|
-
return (0);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
void
|
|
175
|
-
write_archive(const char *outname, const char **filename)
|
|
176
|
-
{
|
|
177
|
-
struct mydata *mydata = malloc(sizeof(struct mydata));
|
|
178
|
-
struct archive *a;
|
|
179
|
-
struct archive_entry *entry;
|
|
180
|
-
struct stat st;
|
|
181
|
-
char buff[8192];
|
|
182
|
-
int len;
|
|
183
|
-
int fd;
|
|
184
|
-
|
|
185
|
-
a = archive_write_new();
|
|
186
|
-
mydata->name = outname;
|
|
187
|
-
/* Set archive format and filter according to output file extension.
|
|
188
|
-
* If it fails, set default format. Platform depended function.
|
|
189
|
-
* See supported formats in archive_write_set_format_filter_by_ext.c */
|
|
190
|
-
if (archive_write_set_format_filter_by_ext(a, outname) != ARCHIVE_OK) {
|
|
191
|
-
archive_write_add_filter_gzip(a);
|
|
192
|
-
archive_write_set_format_ustar(a);
|
|
193
|
-
}
|
|
194
|
-
archive_write_open(a, mydata, myopen, mywrite, myclose);
|
|
195
|
-
while (*filename) {
|
|
196
|
-
stat(*filename, &st);
|
|
197
|
-
entry = archive_entry_new();
|
|
198
|
-
archive_entry_copy_stat(entry, &st);
|
|
199
|
-
archive_entry_set_pathname(entry, *filename);
|
|
200
|
-
archive_write_header(a, entry);
|
|
201
|
-
if ((fd = open(*filename, O_RDONLY)) != -1) {
|
|
202
|
-
len = read(fd, buff, sizeof(buff));
|
|
203
|
-
while (len > 0) {
|
|
204
|
-
archive_write_data(a, buff, len);
|
|
205
|
-
len = read(fd, buff, sizeof(buff));
|
|
206
|
-
}
|
|
207
|
-
close(fd);
|
|
208
|
-
}
|
|
209
|
-
archive_entry_free(entry);
|
|
210
|
-
filename++;
|
|
211
|
-
}
|
|
212
|
-
archive_write_free(a);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
int main(int argc, const char **argv)
|
|
216
|
-
{
|
|
217
|
-
const char *outname;
|
|
218
|
-
argv++;
|
|
219
|
-
outname = *argv++;
|
|
220
|
-
write_archive(outname, argv);
|
|
221
|
-
return 0;
|
|
222
|
-
}
|
|
223
|
-
.Ed
|
|
224
|
-
.Sh SEE ALSO
|
|
225
|
-
.Xr tar 1 ,
|
|
226
|
-
.Xr archive_write_set_options 3 ,
|
|
227
|
-
.Xr libarchive 3 ,
|
|
228
|
-
.Xr cpio 5 ,
|
|
229
|
-
.Xr mtree 5 ,
|
|
230
|
-
.Xr tar 5
|
|
231
|
-
.Sh HISTORY
|
|
232
|
-
The
|
|
233
|
-
.Nm libarchive
|
|
234
|
-
library first appeared in
|
|
235
|
-
.Fx 5.3 .
|
|
236
|
-
.Sh AUTHORS
|
|
237
|
-
.An -nosplit
|
|
238
|
-
The
|
|
239
|
-
.Nm libarchive
|
|
240
|
-
library was written by
|
|
241
|
-
.An Tim Kientzle Aq kientzle@acm.org .
|
|
242
|
-
.Sh BUGS
|
|
243
|
-
There are many peculiar bugs in historic tar implementations that may cause
|
|
244
|
-
certain programs to reject archives written by this library.
|
|
245
|
-
For example, several historic implementations calculated header checksums
|
|
246
|
-
incorrectly and will thus reject valid archives; GNU tar does not fully support
|
|
247
|
-
pax interchange format; some old tar implementations required specific
|
|
248
|
-
field terminations.
|
|
249
|
-
.Pp
|
|
250
|
-
The default pax interchange format eliminates most of the historic
|
|
251
|
-
tar limitations and provides a generic key/value attribute facility
|
|
252
|
-
for vendor-defined extensions.
|
|
253
|
-
One oversight in POSIX is the failure to provide a standard attribute
|
|
254
|
-
for large device numbers.
|
|
255
|
-
This library uses
|
|
256
|
-
.Dq SCHILY.devminor
|
|
257
|
-
and
|
|
258
|
-
.Dq SCHILY.devmajor
|
|
259
|
-
for device numbers that exceed the range supported by the backwards-compatible
|
|
260
|
-
ustar header.
|
|
261
|
-
These keys are compatible with Joerg Schilling's
|
|
262
|
-
.Nm star
|
|
263
|
-
archiver.
|
|
264
|
-
Other implementations may not recognize these keys and will thus be unable
|
|
265
|
-
to correctly restore device nodes with large device numbers from archives
|
|
266
|
-
created by this library.
|