Go to the documentation of this file.
44 static unsigned round_up(
unsigned n,
unsigned incr) {
45 return n + (incr -
n % incr) % incr;
51 unsigned char *p = (
unsigned char*) rh;
64 int err = tar->
read(tar,
data, size);
80 for (i = 0; i <
n; i++) {
81 err =
twrite(tar, &nul, 1);
91 unsigned chksum1, chksum2;
100 sscanf(rh->
checksum,
"%o", &chksum2);
101 if (chksum1 != chksum2) {
122 memset(rh, 0,
sizeof(*rh));
133 sprintf(rh->
checksum,
"%06o", chksum);
152 return "unknown error";
157 unsigned res = fwrite(
data, 1, size,
reinterpret_cast<FILE *
>(tar->
stream));
162 unsigned res = fread(
data, 1, size,
reinterpret_cast<FILE *
>(tar->
stream));
167 int res = fseek(
reinterpret_cast<FILE *
>(tar->
stream), offset, SEEK_SET);
172 fclose(
reinterpret_cast<FILE *
>(tar->
stream));
182 memset(tar, 0,
sizeof(*tar));
189 if ( strchr(
mode,
'r') )
mode =
"rb";
190 if ( strchr(
mode,
'w') )
mode =
"wb";
191 if ( strchr(
mode,
'a') )
mode =
"ab";
212 return tar->
close(tar);
217 int err = tar->
seek(tar, pos);
276 err =
tread(tar, &rh,
sizeof(rh));
309 err =
tread(tar, ptr, size);
328 return twrite(tar, &rh,
sizeof(rh));
335 memset(&h, 0,
sizeof(h));
348 memset(&h, 0,
sizeof(h));
int(* close)(mtar_t *tar)
static int write_null_bytes(mtar_t *tar, int n)
based on the size of the this randomly makes land number of spaces randomly lower or higher The default is Note that this is run also based on the the altitude amount will likely be less So if you do something like l and n
static unsigned round_up(unsigned n, unsigned incr)
int mtar_find(mtar_t *tar, const char *name, mtar_header_t *h)
static int file_close(mtar_t *tar)
int mtar_next(mtar_t *tar)
static unsigned checksum(const mtar_raw_header_t *rh)
linux kernel c mode(defun linux-c-mode() "C mode with adjusted defaults for use with the Linux kernel."(interactive)(c-mode)(c-set-style "K&R")(setq c-basic-offset 8))
static int file_read(mtar_t *tar, void *data, unsigned size)
Plugin animator file specs[Config] name
static int header_to_raw(mtar_raw_header_t *rh, const mtar_header_t *h)
int mtar_close(mtar_t *tar)
int mtar_open(mtar_t *tar, const char *filename, const char *mode)
int mtar_finalize(mtar_t *tar)
int mtar_write_data(mtar_t *tar, const void *data, unsigned size)
int mtar_write_file_header(mtar_t *tar, const char *name, unsigned size)
int mtar_rewind(mtar_t *tar)
int mtar_seek(mtar_t *tar, unsigned pos)
int(* read)(mtar_t *tar, void *data, unsigned size)
int mtar_read_header(mtar_t *tar, mtar_header_t *h)
const char * mtar_strerror(int err)
static int file_seek(mtar_t *tar, unsigned offset)
int mtar_write_header(mtar_t *tar, const mtar_header_t *h)
#define offsetof(type, member)
int mtar_write_dir_header(mtar_t *tar, const char *name)
static int tread(mtar_t *tar, void *data, unsigned size)
static int file_write(mtar_t *tar, const void *data, unsigned size)
static int raw_to_header(mtar_header_t *h, const mtar_raw_header_t *rh)
static int twrite(mtar_t *tar, const void *data, unsigned size)
int(* seek)(mtar_t *tar, unsigned pos)
int(* write)(mtar_t *tar, const void *data, unsigned size)
int mtar_read_data(mtar_t *tar, void *ptr, unsigned size)