diff options
author | Jay Freeman <saurik@saurik.com> | 2008-06-16 20:04:36 +0000 |
---|---|---|
committer | Jay Freeman <saurik@saurik.com> | 2008-06-16 20:04:36 +0000 |
commit | da867033916f9a1c940ca49813df5bcbdc202059 (patch) | |
tree | 00375ceb42f4cf036efcc63fc1d3e9659dd854cd /util | |
parent | cc5f9882aa93d30ad944b390a4a20bf21478ef42 (diff) |
Added .ar and .elc determinism.
git-svn-id: http://svn.telesphoreo.org/trunk@317 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'util')
-rw-r--r-- | util/arid.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/util/arid.cpp b/util/arid.cpp new file mode 100644 index 000000000..ab2bccb60 --- /dev/null +++ b/util/arid.cpp @@ -0,0 +1,29 @@ +#include <iostream> +#include "minimal/mapping.h" + +struct ar_hdr { + char ar_name[16]; + char ar_date[12]; + char ar_uid[6]; + char ar_gid[6]; + char ar_mode[8]; + char ar_size[10]; +#define ARFMAG "`\n" + char ar_fmag[2]; +}; + +int main(int argc, char *argv[]) { + size_t size; + _assert(argc == 2); + uint8_t *data = reinterpret_cast<uint8_t *>(map(argv[1], 0, _not(size_t), &size, false)); + data += 8; + uint8_t *end = data + size; + while (end - data >= sizeof(struct ar_hdr)) { + struct ar_hdr *head = reinterpret_cast<struct ar_hdr *>(data); + memset(head->ar_date + 1, ' ', sizeof(head->ar_date) - 1); + head->ar_date[0] = '0'; + size_t length = strtoul(head->ar_size, NULL, 10); + data += length + sizeof(struct ar_hdr); + } + return 0; +} |