uint8_t buf[1024];
uint32_t crc32;
- hdr->magic = cpu_to_le32(TRX_MAGIC);
hdr->version = 1;
fseek(trx, 0, SEEK_SET);
ssize_t sbytes;
size_t curr_idx = 0;
size_t curr_offset = sizeof(hdr);
+ char *e;
+ uint32_t magic;
int c;
int err = 0;
+ hdr.magic = cpu_to_le32(TRX_MAGIC);
+
if (argc < 3) {
fprintf(stderr, "No TRX file passed\n");
err = -EINVAL;
fseek(trx, curr_offset, SEEK_SET);
optind = 3;
- while ((c = getopt(argc, argv, "f:A:a:b:")) != -1) {
+ while ((c = getopt(argc, argv, "f:A:a:b:M:")) != -1) {
switch (c) {
case 'f':
if (curr_idx >= TRX_MAX_PARTS) {
curr_offset += sbytes;
}
break;
+ case 'M':
+ errno = 0;
+ magic = strtoul(optarg, &e, 0);
+ if (errno || (e == optarg) || *e)
+ fprintf(stderr, "illegal magic string %s\n", optarg);
+ else
+ hdr.magic = cpu_to_le32(magic);
+ break;
}
if (err)
break;