#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "domain2name.c"
int main (int argc, char * const argv[]) {
if (argc != 2) {
fprintf(stderr, "%s domain\n", argv[0]);
return 1;
}
int r, s = domain2name_len(argv[1], strlen(argv[1]));
char * b = alloca(s);
r = domain2name(b, argv[1], strlen(argv[1]));
fprintf(stderr, "strlen %d name2domain_len %d\n", strlen(argv[1]), name2domain_len(b, b));
int l = name2domain_len(b, b);
if (l < 0) {
fprintf(stderr, "name2domain_len error: %d\n", l);
} else {
char * d = alloca(l);
name2domain(d, b, b);
fprintf(stderr, "name2domain: %s\n", d);
}
printf("%4dB %4dB (-:\n", s, r); /* xxd has 16 bytes per row */
printf("%s", b);
fflush(stdout);
}