Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Basic implementation of a GNU tar-compatible writer. This uses
the header conventions used by GNU tar 1.13 and later.  In particular:
 * name and linkname are permitted to fill their respective fields
   (Earlier GNU tar guaranteed a trailing null)
 * mode field does not include the file type
   (Earlier GNU tar included file type bits in the mode field)
 * Most fields are filled with leading '0' characters
   (Earlier GNU tar used leading spaces)

SVN-Revision: 2264
  • Loading branch information
kientzle committed Apr 18, 2010
1 parent 36b755d commit 7862cf7
Show file tree
Hide file tree
Showing 8 changed files with 773 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Makefile.am
Expand Up @@ -168,6 +168,7 @@ libarchive_la_SOURCES= \
libarchive/archive_write_set_format_pax.c \
libarchive/archive_write_set_format_shar.c \
libarchive/archive_write_set_format_ustar.c \
libarchive/archive_write_set_format_gnutar.c \
libarchive/archive_write_set_format_zip.c \
libarchive/archive_write_set_options.c \
libarchive/config_freebsd.h \
Expand Down Expand Up @@ -329,6 +330,7 @@ libarchive_test_SOURCES= \
libarchive/test/test_write_format_cpio_empty.c \
libarchive/test/test_write_format_cpio_odc.c \
libarchive/test/test_write_format_cpio_newc.c \
libarchive/test/test_write_format_gnutar.c \
libarchive/test/test_write_format_iso9660.c \
libarchive/test/test_write_format_iso9660_boot.c \
libarchive/test/test_write_format_iso9660_empty.c \
Expand Down
1 change: 1 addition & 0 deletions libarchive/CMakeLists.txt
Expand Up @@ -83,6 +83,7 @@ SET(libarchive_SOURCES
archive_write_set_format_by_name.c
archive_write_set_format_cpio.c
archive_write_set_format_cpio_newc.c
archive_write_set_format_gnutar.c
archive_write_set_format_iso9660.c
archive_write_set_format_mtree.c
archive_write_set_format_pax.c
Expand Down
1 change: 1 addition & 0 deletions libarchive/archive.h
Expand Up @@ -578,6 +578,7 @@ __LA_DECL int archive_write_set_format_ar_bsd(struct archive *);
__LA_DECL int archive_write_set_format_ar_svr4(struct archive *);
__LA_DECL int archive_write_set_format_cpio(struct archive *);
__LA_DECL int archive_write_set_format_cpio_newc(struct archive *);
__LA_DECL int archive_write_set_format_gnutar(struct archive *);
__LA_DECL int archive_write_set_format_iso9660(struct archive *);
__LA_DECL int archive_write_set_format_mtree(struct archive *);
/* TODO: int archive_write_set_format_old_tar(struct archive *); */
Expand Down
3 changes: 2 additions & 1 deletion libarchive/archive_write_set_format.c
Expand Up @@ -42,14 +42,15 @@ static
struct { int code; int (*setter)(struct archive *); } codes[] =
{
{ ARCHIVE_FORMAT_CPIO, archive_write_set_format_cpio },
{ ARCHIVE_FORMAT_CPIO_SVR4_NOCRC, archive_write_set_format_cpio_newc },
{ ARCHIVE_FORMAT_CPIO_POSIX, archive_write_set_format_cpio },
{ ARCHIVE_FORMAT_CPIO_SVR4_NOCRC, archive_write_set_format_cpio_newc },
{ ARCHIVE_FORMAT_ISO9660, archive_write_set_format_iso9660 },
{ ARCHIVE_FORMAT_MTREE, archive_write_set_format_mtree },
{ ARCHIVE_FORMAT_SHAR, archive_write_set_format_shar },
{ ARCHIVE_FORMAT_SHAR_BASE, archive_write_set_format_shar },
{ ARCHIVE_FORMAT_SHAR_DUMP, archive_write_set_format_shar_dump },
{ ARCHIVE_FORMAT_TAR, archive_write_set_format_pax_restricted },
{ ARCHIVE_FORMAT_TAR_GNUTAR, archive_write_set_format_gnutar },
{ ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE, archive_write_set_format_pax },
{ ARCHIVE_FORMAT_TAR_PAX_RESTRICTED,
archive_write_set_format_pax_restricted },
Expand Down
1 change: 1 addition & 0 deletions libarchive/archive_write_set_format_by_name.c
Expand Up @@ -51,6 +51,7 @@ struct { const char *name; int (*setter)(struct archive *); } names[] =
{ "bsdtar", archive_write_set_format_pax_restricted },
{ "cd9660", archive_write_set_format_iso9660 },
{ "cpio", archive_write_set_format_cpio },
{ "gnutar", archive_write_set_format_gnutar },
{ "iso", archive_write_set_format_iso9660 },
{ "iso9660", archive_write_set_format_iso9660 },
{ "mtree", archive_write_set_format_mtree },
Expand Down

0 comments on commit 7862cf7

Please sign in to comment.