Age | Commit message (Collapse) | Author |
|
Since mtar_write_file/dir_header() modify the cached header,
they should perform API checks to detect incorrect usage.
|
|
Rationale: it can be updated and passed to mtar_header_update(),
saving a temporary, and without poking around the struct fields.
|
|
|
|
This operation makes sense now that you can seek backward
when writing a new archive member.
|
|
This allows library users to seek within the written portion of a
file and re-write previously written data. This also includes the
header, which removes the need to specify file size in advance if
the application can tolerate seeking back to update the header at
the end of writing, once the actual file size is known.
|
|
|
|
|
|
|
|
|
|
Return this error if using an archive in the wrong access mode,
ie. write to an archive opened for reading, or vice-versa.
Previously EAPI was returned which is probably not as useful.
|
|
|
|
This is hardly usable and doesn't handle directories or deal with
filenames properly. It's here mainly to test library code.
|
|
The code ends up simpler by having callers explicitly end the
data stream and finalize the archive instead of trying to do
it implicitly. Also fix multiple write related bugs.
|
|
|
|
|
|
They now return the number of bytes read or written or
a negative error code.
|
|
However we don't use enum types in the code for ABI reasons.
|
|
Rationale is similar to providing mtar_finalize(), although
it is functionally useless, users may want to see the error
code for this operation separately.
|
|
This occurs if the caller did not write out enough data
when writing an archive member.
|
|
|
|
It's expected users will provide their own I/O hooks,
so mtar_open() does not really belong in microtar.h.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This allows users to seek within a file without accidentally
skipping over the file's boundaries.
|
|
The demo app can list contents and extract tar files using
microtar, and serves to demonstrate the API.
|
|
This saves library users from checking for two possibilities
and mirrors what we're doing in header_to_raw().
|
|
Returns true when the end of the current file has been reached.
Handy when reading file data in a loop.
|
|
This is a very convienient way of iterating over a tar archive.
It can be used for search operations or data extraction and
mtar_find() has been re-implemented using it.
|
|
1. Iterating over archive members has been simplified. Reading
headers is now implicit; mtar_rewind() jumps to the start
of the archive and calling mtar_next() repeatedly returns
each header in turn. Use mtar_get_header() to retrieve the
header data.
2. Reading file data works similarly to read() / fread() by
returning the number of bytes read instead of forcing the
caller to work out how many bytes are remaining. The old
wraparound behaviour was removed because it is not needed
anymore and proved troublesome in practice.
3. Writing data has not yet been implemented.
|
|
We don't need to round up to arbitrary multiples; using
constants should allow the compiler to optimize better.
|
|
This will only make a negligible difference on a proper OS
and C library, but may assist simpler I/O implementations.
|
|
Prefer accessing the raw data as a plain char array, this
makes the code immune to bugs induced by a compiler adding
padding between struct fields. (The alternative is to add
ugliness to the header to ensure the struct is packed.)
|
|
This was done wrongly, and in any event it is the user's
responsibility to use the right mode for the OS.
|
|
Moving stream ops into a separate struct lets them be
defined in a const object and shared between multiple
mtar_t objects.
Also provide a new mtar_init() call which accepts the
ops struct and initializes the mtar_t object properly.
|
|
This is frivolous, but I really don't like the current style.
|
|
|
|
|
|
|
|
|
|
Added c++ compilation support.
|
|
|
|
|
|
|