+ int zttl = ttl - i;
+ if (zttl < 60) { zttl = 60; }
+
+ for (int j = 0; j < addr_count; j++) {
+ char fmt[7*5];
+ memset(fmt, 0, sizeof(fmt));
+ for (int k = 0; k < 7; k++) {
+ char* target = fmt + k * 5;
+ int start = j*14*2 + k*4 - 2;
+ int count = header_len*2 - start;
+ if (start < 0) {
+ start = 0;
+ target[0] = '0';
+ target[1] = '1';
+ target += 2;
+ if (count > 2) count = 2;
+ }
+ if (count < 0) {
+ fmt[k*5] = '0';
+ continue;
+ }
+ if (count > 4) count = 4;
+ assert(count % 2 == 0);
+ memcpy(target, &hex[i * header_len*2 + start], count);
+ if (count < 4 && start != 0) {
+ target[2] = '0';
+ target[3] = '0';
+ }
+ }
+ dprintf(out_fd, "v2.%d %d IN AAAA 260%d:%s:%s:%s:%s:%s:%s:%s\n",
+ start_height + i, zttl, j,
+ &fmt[0 * 5],
+ &fmt[1 * 5],
+ &fmt[2 * 5],
+ &fmt[3 * 5],
+ &fmt[4 * 5],
+ &fmt[5 * 5],
+ &fmt[6 * 5]);
+ }