Commit graph

66 commits

Author SHA1 Message Date
7046dfb1e5 More robust cleanup of temporary file 2024-07-18 22:08:48 +09:00
1d85ddd0e9 Improve error print
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
2024-07-18 18:55:42 +09:00
ecb0c751d8 Print permissions when in "-t" mode
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
2024-07-18 15:57:45 +09:00
99e1a2d850 Fix error when checking with "-t"
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
2024-07-18 15:49:22 +09:00
c4ff2347ff Improve error printing
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 5s
2024-07-18 15:46:27 +09:00
c18e772928 Remove unnecessary "include"s
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
2024-07-18 15:36:09 +09:00
735d2b4f7a Comment out debug print
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
2024-07-18 15:32:48 +09:00
4985672ea2 Impl. extract "white-list"
When extracting, the given positional args will determine a "white-list"
of files to extract. If no positional args are given, then all files in
the archive will be extracted.
2024-07-18 15:30:05 +09:00
0a6afe6148 Improve error handling when parsing/extracting
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
2024-07-18 14:39:01 +09:00
5b3a7e3994 Fix extracting when no compressor was used
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
2024-07-18 14:17:50 +09:00
4cb4184338 Store/restore file permissions
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
2024-07-18 14:02:15 +09:00
17f89e5a68 "Fix" windows build
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
2024-07-18 13:33:35 +09:00
da2a0f7b1c Implement extracting from archive
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 5s
TODO:
    Storing file permissions to be extracted with same permissions.
    Archiving and extracting symbolic links.
2024-07-18 13:27:32 +09:00
0449ab389e Add helper to create dirs from filepath 2024-07-18 11:53:00 +09:00
af235ff878 Use waitpid on compress to avoid defunct processes
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
2024-07-17 19:00:34 +09:00
fe04dc7018 Output when writing file to archive
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
2024-07-17 17:22:44 +09:00
be67425d21 Impl. compressing with arbitrary command
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
TODO:
    Archive extracting.
    Create archive with symbolic links.
2024-07-17 16:37:32 +09:00
bbdcd660a5 Minor fixes
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
2024-07-17 15:01:39 +09:00
ea845f2552 Impl. setup for de/compression
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
Some setup code in preparation of doing the actual file compression when
creating an archive.
2024-07-17 14:32:39 +09:00
0299129ea6 "-t": Note that file is compressed if compressed
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
2024-07-17 13:35:04 +09:00
2364f53649 Impl. "-t" command (printing archive info)
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
TODO:
    Write symbolic links into archive when creating.
    Use De/compressor cmds when creating archive.
    Extracting archive.
2024-07-17 13:30:05 +09:00
58daa1130d Update parser flags to allow "checking" with "-t"
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
2024-07-17 12:13:33 +09:00
875e4bb2a4 Add "status progress" when archiving
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
2024-07-16 16:44:54 +09:00
41fde43eed Impl. basic functionality "MVP"
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 48s
"MinimumViableProduct", resolves #2 .

TODO:
  Support de/compressor cmds when creating archive.
  Support symbolic links when creating archive.
  Support extracting archive.
2024-07-16 16:16:58 +09:00
4670f0f3c1 big-endian convert: Use stdint.h
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 5s
Replace "unsigned short" with uint16_t, "unsigned int" with uint32_t,
and "unsigned long long" with uint64_t.
2024-07-15 17:00:49 +09:00
cb79e4e45c Minor tweaks to file format
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
2024-07-15 15:43:14 +09:00
efffb8c147 Add "--overwrite-create"
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 45s
Default behavior is now to NOT overwrite existing archive files for
storing output unless "--overwrite-create" is specified.
2024-07-11 16:56:23 +09:00
e315ac5c33 Revise file_format.md
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 5s
Specify how symlink paths should be handled if they do not exist (path
size of 0).
2024-07-10 18:59:00 +09:00
58269d751c Impl. handling symbolic links
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
2024-07-04 14:48:56 +09:00
20cb6cb3aa Remove unnecessary "TODO" in comment. 2024-07-04 13:50:32 +09:00
e0373d693d Update file_format.md
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 45s
Make strings NULL-terminated.
2024-07-04 13:48:39 +09:00
004f4f2cd9 revise file_format.md
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
2024-07-04 13:13:52 +09:00
174d30a8b6 Update file_format.md
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
Resolves #11 .
2024-07-04 13:10:22 +09:00
518ac3ebe1 parser: Enable existing codepath for OSX
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 5s
The Unix functions/headers used in parser for getting files/dirs from
the given positional arguments are also available in OSX
(theoretically), so they are now enabled for OSX platforms.

TODO: Add getting files/dirs code for the Windows platform.
2024-07-04 11:54:15 +09:00
6ee347da12 Handle symbolic links separately
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
Previous implementation could loop forever following a symbolic link
that goes backwards. This commit makes symbolic links an "unhandled file
type" for now.
2024-07-03 20:25:42 +09:00
c9df661cd3 "platforms.h" include should be before its usage
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
2024-07-03 20:01:19 +09:00
e06e65e5e8 Impl. parser accepting files and dirs
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
Fix memory leak in hash_map.

Current "main" prints specified files and subfiles of specified
directories.

TODO: Handle symbolic links
2024-07-03 19:56:26 +09:00
8d912ce780 Remove 'extern' from parser.h 2024-07-03 17:55:35 +09:00
69051a6c24 Add helpers for conversion to/from big-endian
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
Also added tests for big-endian-conversion functions.
2024-07-02 14:25:01 +09:00
eb1f09b551 Revise file_format
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
The changes should allow for the .simplearchive file to be directly
outputted to standard out in a single pass.

Resolves #10 .
2024-07-02 14:02:38 +09:00
3172920c9c Some work on arg parser
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 7s
Also added unit tests for arg parser.
2024-07-01 15:13:06 +09:00
467c09a0e4 Fix unit test for priority heap
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
2024-06-30 20:02:47 +09:00
9e95c5e292 Change priority_heap to accept "less_fn"
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
This allows for reverse order in the priority heap by using a "more_fn"
in place of a "less fn".
2024-06-30 17:29:24 +09:00
d815f67b2d Minor fix to doc comment about priority heap
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
2024-06-30 15:35:27 +09:00
fbe62ba5b2 Impl. priority heap, minor tweaks/fixes
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
Implemented a priority heap.

Added tests for the priority heap.

Add a "default" lcg generator function.

Tweak hash_map to use the default lcg generator function.

`clang-format`.
2024-06-30 15:32:17 +09:00
ea919f3eb3 Add platforms.h header to determine platform
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s
The platforms.h header will allow for using/implementing OS-specific
code that will differ based on the platform the program is compiled for.
2024-06-29 16:52:17 +09:00
86a68eef83 Add action/workflow to run unit tests
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
Currently only runs `test_datastructures`.
2024-06-29 16:13:15 +09:00
aa00131020 Update README.md 2024-06-29 16:00:59 +09:00
0a2aef0fd1 Fix cosmopolitan/Makefile missing files 2024-06-28 19:35:06 +09:00
aa2a1bf583 Fix hashing in hash_map (hopefully finally) 2024-06-28 18:19:29 +09:00