Commit Graph

120 Commits

Author SHA1 Message Date
a6d38efc7d
chore: bump patch version 2023-02-15 19:24:54 +01:00
85a6d79151
fix: Shorten the 'name' field in minitar_entry_metadata
Sure, 256 characters might fit in 'path', but because of the way
paths are stored in a tar archive, basenames cannot exceed 100
characters. So, adding space for a null-terminator, this reduces
our 'name' field from 128 bytes to 101.

This change is backwards-compatible since any reasonable application
should not depend on the name field being 128 bytes (this was never
mentioned in any documentation, API.md describes it as 'char[]' without
a fixed length). sizeof(metadata.name) should always be used instead.
2023-02-09 16:41:26 +01:00
320231c70b
fix: Make the 'list' example show more metadata 2023-02-09 16:40:57 +01:00
7571ef42c6
fix: Cast time_t to a known type for snprintf() 2023-02-06 23:18:05 +01:00
88d6fbffb7
fix: Check for _WIN32 instead of _MSC_VER 2023-02-06 23:17:28 +01:00
01d3c27d41
chore: bump patch version 2023-02-06 22:42:31 +01:00
bf52d9e321
fix: Handle malloc errors properly in pack.c 2023-02-05 14:38:31 +01:00
7339aeeae5
chore: Add platform-specific example targets
Someone might want to build only the examples that work on non-POSIX, or the ones that work on POSIX.
2023-02-05 14:33:59 +01:00
40302ddd41
fix: Do not define metadata twice in examples/pack.c 2023-02-05 14:30:29 +01:00
8cb5175630
fix: Do not #include <sys/types.h> on Windows
Instead, we provide our own typedef for mode_t, uid_t and gid_t, and we get time_t from <time.h>.
2023-02-05 14:22:31 +01:00
5bfc7e45ac
chore: Adjust comment in minitar_write_file_entry() 2023-02-05 14:14:37 +01:00
873f056cc3
chore: bump minor version 2023-02-04 19:42:12 +01:00
9b39f43595
docs: Make it clearer that "minitar" and "minitar_w" are handle structs 2023-02-04 19:39:12 +01:00
9c43461e02
docs: Remove section about unsupported entry types in API.md
There are no unsupported types anymore.
2023-02-04 19:37:15 +01:00
53aa377bbb
docs: Update docs/API.md with a proper link to the error handling section 2023-02-04 19:35:17 +01:00
f09e6f2e85
docs: Add documentation for the new "writing" API 2023-02-04 19:33:23 +01:00
845b357bef
Update README.md 2023-02-04 19:04:29 +01:00
482ac6d949
feat: Add write support
This uses a new struct (struct minitar_w).
This struct is initialized using the minitar_open_w function, and deleted using minitar_close_w.

The functions to write to an archive are minitar_write_file_entry() and minitar_write_special_entry().
The difference is that regular files have content, while the rest (special entries) do not.

This commit also adds a new example program (pack), which can create tar archives from files (no directory support though).

Archives created using pack and minitar can be read and extracted using GNU tar!!

Documentation is coming in another commit.
2023-02-04 19:02:08 +01:00
95700b6916
docs: Update function signature of minitar_read_contents() 2023-01-29 22:20:15 +01:00
45fbd789d6
docs: Add APi documentation for MTAR_CHRDEV and MTAR_BLKDEV
Missed that in the previous commits.
2023-01-29 22:14:05 +01:00
e96f7127bf
chore: bump minor version 2023-01-29 22:10:04 +01:00
e9ca265068
fix: Deprecate MINITAR_IGNORE_UNSUPPORTED_TYPES 2023-01-29 22:08:13 +01:00
5b0d597c09
feat: Add support for block and character devices 2023-01-29 22:07:54 +01:00
1f08cf4b31
feat: Add support for FIFOs 2023-01-27 23:00:53 +01:00
3772e9e3a6
feat: Add support for hard links 2023-01-27 22:46:18 +01:00
94324c502e
chore: Add a small shell script to generate release changelogs 2023-01-26 22:23:38 +01:00
ce0db53a90
chore: bump minor version 2023-01-26 22:14:22 +01:00
599cac5811
feat: Add support for symbolic links
All the pieces were in place, we just needed to put them together.

Sorry, but sub-500 LoC isn't gonna work anymore...
2023-01-26 22:12:42 +01:00
4c90f9078b
fix: Use memcpy() in minitar_strlcpy()
This allows the platform to provide a more optimized and FAST version of memcpy than
our manual implementation inside strlcpy.
2023-01-26 21:40:57 +01:00
56250a226f
chore: Add a CMake target to build all examples 2023-01-19 22:44:01 +01:00
d8faf424ad
fix: Skip the padding field when calculating header checksums 2023-01-19 22:32:01 +01:00
240a4f2f1a
chore: Add examples to CMake as opt-in targets 2023-01-19 22:30:23 +01:00
9a7629459e
chore: Add copyright headers to all source files 2023-01-12 21:04:52 +01:00
bacc971007
docs: Add build instructions 2023-01-12 20:45:46 +01:00
8e16524e1c
docs: Add a note about examples to README.md 2023-01-12 20:06:22 +01:00
e758012948
feat: Add two examples 2023-01-12 20:04:28 +01:00
27dac123f4
fix: Make minitar_read_contents() take a const pointer to entry 2023-01-12 20:03:42 +01:00
912b98d2d7
fix: Include stddef.h in minitar.h to make sure we have size_t 2023-01-12 20:02:13 +01:00
5be3c7d684
Enable syntax highlighting for the sample program 2023-01-12 19:34:33 +01:00
dead1e3ee2
feat: Move all internal structures to a minitar_entry_internal struct 2023-01-12 19:20:32 +01:00
07c156c30b
docs: Move API docs to docs/API.md and link there from README 2023-01-12 19:15:53 +01:00
a790b6f960
docs: Clarify some sentences 2023-01-12 19:13:31 +01:00
d9b0dce41a
Remove minitar_panic() wrapper around minitar_handle_panic() 2023-01-12 19:01:55 +01:00
e568e88617
Remove assertion that was not used
minitar_static_dup() is always called with sizes MUCH smaller than 1024.
2023-01-12 19:00:12 +01:00
7b83dce96a
feat: calculate header checksums and validate them against hdr->chksum
Fixes #2.
2023-01-11 21:02:37 +01:00
f2f4d4ddab
Update tar.h to use MSVC-compatible struct packing
Fixes #3.
2023-01-08 12:47:09 +01:00
087b099917
Documentation update 2022-12-31 12:57:24 +01:00
55276a78e2
Add newlines at EOF so clang doesn't complain 2022-12-31 12:51:47 +01:00
ab80b8ba45
Correct includes 2022-12-31 12:48:53 +01:00
39d5ee5b9a
Remove dependency on strtoul() and strtoull() by making our own specialized parse_octal() function 2022-12-31 12:40:21 +01:00