It is often convenient to dump raw information from a change file such as the offsets in the header and the bytes of the contents section.
This adds a flag to the change subcommand that will produce a raw dump of the indicated change file.
XDWQHPFDPJFZLSS5HL6FVH2XCTLC33ATWAG7VY4MDOXNFL5ZXNTAC
ZS3UJEZU4PZEYOXQNZWZGDNXTP5ESNPRAEHPJQ24O3TWZH746IBQC
ZTDGWUGPKDVIUA6V5BZ5ATDTGKZEE6ZZIXLGNTUJU2KIV7H7YSVQC
Q7TKZCJP2Z75EICZYKCEZDHKGERSOKZGMTSU3UXETBHTF663T66AC
5D2IYPL75HEP6JUEILEADSZRRSV72NECT6UQR3PORNDR35I2P5GQC
RRYWNHFE3EIRQYBGMSZRLDGKWHVMDAO42QNKFQ2KVYPDC4IHANTAC
2U7P5SFQG3AVALKMPJF4WMZE6PXIXXZYOMZ3RZKILBUJ4UMFXVIAC
3FT3XTJMUAXQ257T5GB7YWWTI7QBKKVC7WA6DCH5UY26RLQO5PFQC
QEFCNNVCEDFUV7O4ASWVI4QUTUFWLHAOTJMDCZ3DFJIUQWTAN3SAC
}
void
print_raw_change(struct changestore *changes, struct change *ch)
{
usize i;
printf("offsets\n");
printf(" version: %lu\n", ch->offsets.version);
printf(" hashed_len: %lu\n", ch->offsets.hashed_len);
printf(" unhashed_off: %lu\n", ch->offsets.unhashed_off);
printf(" unhashed_len: %lu\n", ch->offsets.unhashed_len);
printf(" contents_off: %lu\n", ch->offsets.contents_off);
printf(" contents_len: %lu\n", ch->offsets.contents_len);
printf(" total: %lu\n", ch->offsets.total);
printf("\n");
if (ch->offsets.contents_len > 0) {
printf("contents: [");
printf("0x%02x", ch->contents[0]);
for (i = 1; i < ch->offsets.contents_len; i++) {
printf(", 0x%02x", ch->contents[i]);
}
printf("]\n");
}