The code in db.c was implemented as a standalone at first, and the err() macro was a remnant of that. This brings it more in line with the existing implementation.
HUOUNPBGFGT4IT5PPCRLJJUN6IXKEMMV3GP6QADXFVYBZS4OTK4QC
ZYBYX2TBKWAKNMPCWT3B7CJRDEO3LOENGOXZF27JGD4UH6YCN25AC
#include <errno.h>#include <string.h>
#include <errno.h>
#include <string.h>
#define err(msg) \ do { \ perror(msg); \ exit(EXIT_FAILURE); \ } while (0)
#define err(msg) \
do { \
perror(msg); \
exit(EXIT_FAILURE); \
} while (0)
for (i = 0; i < len; i++) { printf("%02x ", mem[i]);
for (i = 0; i < len; i++) {
printf("%02x ", mem[i]);
printf("%02x", mem[0]); for (i = 1; i < len; i++) { printf(" %02x", mem[i]);
printf("%02x", mem[0]);
for (i = 1; i < len; i++) {
printf(" %02x", mem[i]);
printglobalheader(struct globalheader *gh, bool currentroot)
printglobalheader(struct globalheader *gh, size i, bool currentroot)
printf("--- root page %lu ---\n", i);
printf("freedb = %lu\n", gh->freedb);
printf("freedb = %lu (0x%08lx)\n", gh->freedb, gh->freedb);
err("open");
die("open:%s", strerror(errno));
err("mmap");
die("mmap:%s", strerror(errno));
printglobalheader(&gh, curroot == 0);
printglobalheader(&gh, 0, curroot == 0);
err("mmap2");
printglobalheader(&gh, curroot == i);
printglobalheader(&gh, i, curroot == i);