diff options
author | kientzle <kientzle@FreeBSD.org> | 2008-03-14 23:00:53 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2008-03-14 23:00:53 +0000 |
commit | f9f0592c21ed6360f9ab668e645729680e2378fe (patch) | |
tree | 7b104af8012a4823c92e36f7f184881a229e9380 /lib/libarchive/archive_entry.c | |
parent | 8229d34b1adb034bcde30845b04d0ac154a652ff (diff) | |
download | FreeBSD-src-f9f0592c21ed6360f9ab668e645729680e2378fe.zip FreeBSD-src-f9f0592c21ed6360f9ab668e645729680e2378fe.tar.gz |
New public functions archive_entry_copy_link() and archive_entry_copy_link_w()
override the currently set link value, whether that's a hardlink
or a symlink. Plus documentation update and tests.
Diffstat (limited to 'lib/libarchive/archive_entry.c')
-rw-r--r-- | lib/libarchive/archive_entry.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/libarchive/archive_entry.c b/lib/libarchive/archive_entry.c index ccb7854..8fbc0ac 100644 --- a/lib/libarchive/archive_entry.c +++ b/lib/libarchive/archive_entry.c @@ -754,6 +754,28 @@ archive_entry_set_link(struct archive_entry *entry, const char *target) aes_set_mbs(&entry->ae_hardlink, target); } +/* Set symlink if symlink is already set, else set hardlink. */ +void +archive_entry_copy_link(struct archive_entry *entry, const char *target) +{ + if (entry->ae_symlink.aes_mbs != NULL || + entry->ae_symlink.aes_wcs != NULL) + aes_copy_mbs(&entry->ae_symlink, target); + else + aes_copy_mbs(&entry->ae_hardlink, target); +} + +/* Set symlink if symlink is already set, else set hardlink. */ +void +archive_entry_copy_link_w(struct archive_entry *entry, const wchar_t *target) +{ + if (entry->ae_symlink.aes_mbs != NULL || + entry->ae_symlink.aes_wcs != NULL) + aes_copy_wcs(&entry->ae_symlink, target); + else + aes_copy_wcs(&entry->ae_hardlink, target); +} + void archive_entry_set_mode(struct archive_entry *entry, mode_t m) { |