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
d8faf424ad
fix: Skip the padding field when calculating header checksums
2023-01-19 22:32:01 +01:00
9a7629459e
chore: Add copyright headers to all source files
2023-01-12 21:04:52 +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
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
165352cdca
Bounds checking :)
2022-12-30 11:13:55 +01:00
d018d128a0
Optionally ignore unsupported types instead of panicking
2022-12-30 11:13:21 +01:00
7d4e774cf7
Rewrite the entire API just to eliminate heap allocations
...
Just bumping minor because nobody uses this and I don't want to jump up to 2.0.0
2022-12-25 14:33:47 +01:00
89bc990725
More optimization and heap elimination
2022-12-25 13:31:11 +01:00
555059a742
PERFORMANCE OPTIMIZATIONS
2022-12-25 13:21:09 +01:00
41a1e23abf
Remove -ansi and make it compile under TCC
2022-12-25 13:06:02 +01:00
51b09f35ad
MSVC does not have __attribute__((weak))
2022-12-25 13:00:47 +01:00
23c313d9cf
Get rid of libgen.h in favor of our own basename :)
2022-12-25 12:51:35 +01:00
c78566bb27
Split basename parsing into a helper function
2022-12-01 19:37:37 +01:00
125ec8f063
Provide strdup ourselves
2022-12-01 19:30:51 +01:00
28d1eab1c1
Remove character and block devices from supported entry types
...
Closes #1 .
2022-11-30 11:20:13 +01:00
eeb7bccda8
Skip null-terminating a result already null-terminated by strlcpy()
2022-11-30 11:14:11 +01:00
7b5e6196a7
Make some functions only used in util.c static
2022-11-23 20:59:15 +01:00
9fe8159d5a
More commenting + minitar_get_size_in_blocks -> minitar_align_up_to_block_size
2022-11-23 20:39:34 +01:00
653f9a90d0
Provide our own strndup + a lot more comments going on
2022-11-23 20:32:05 +01:00
fd85cf1c6a
Full path is now metadata->path and basename metadata->name
...
Shouldn't have rushed to 1.0.0 so quickly. Oh well, I guess I can allow 1.1.0...
2022-11-23 18:32:10 +01:00
ba7b77bdae
Rename internal function minitar_parse_tar_header -> minitar_parse_metadata_from_tar_header
2022-11-22 17:28:15 +01:00
d123c49946
Do not automatically read an entry's contents, leave it up to the user
...
This API change modifies minitar_read_entry to skip over the file's contents and instead store the current read position in the entry.
struct minitar_entry no longer has a ptr field, but has a position field (of type fpos_t) for internal use.
minitar_free_entry no longer frees entry->ptr.
A new function has been added, minitar_read_contents().
It reads a certain number of bytes from an entry (which is capped to the entry's size) into a user-provided buffer.
This function can be called at any time provided it is called with a valid archive stream and entry.
This is achieved by calling fgetpos() to store the start of the entry's contents in the entry's position field while reading it.
Then minitar_read_contents() will store the current position, rewind to the entry's position, read the chosen number of bytes from the archive, and then rewind back to the current position.
Since this is a breaking change, it needs a major version bump. Since there was no version, I bumped it to 1.0.0 :)
2022-11-21 20:20:37 +01:00
9695889040
Add FIXME
2022-11-21 19:17:29 +01:00
e3fae29713
Safer string copying
2022-11-21 19:15:52 +01:00
6c696c67b1
Revert previous commit, but using strtoul(l) everywhere
...
I'm pretty sure every field in a tar header is unsigned octal...
2022-11-21 19:07:49 +01:00
30c7c0ad57
Determine the signedness of standard types
2022-11-21 19:01:12 +01:00
2aed955e94
Use const pointers when possible
2022-11-21 17:38:08 +01:00
df26e6d772
Rename minitar_read_file to minitar_read_file_contents
2022-11-06 14:23:35 +01:00
28085731f1
Not all 0-sized reads are errors
...
If you requested 0 bytes, the kernel gives you 0 bytes back
2022-11-06 14:14:06 +01:00
fd32be351e
Remove unnecessary include
2022-11-06 12:46:07 +01:00
f2fdf726ce
Add a way to override the panic function
2022-11-06 12:24:13 +01:00
8507f57bc1
Add minitar_rewind()
2022-11-06 11:22:27 +01:00
6c916ad861
Add .clang-format
2022-11-06 11:02:26 +01:00
baf8318c29
Read file contents and store them in entry->ptr
2022-11-06 10:33:37 +01:00
0952af15b4
Basic file listing :)
2022-11-05 20:10:48 +01:00