Jim's latest fixes (DPRINTF/realloc/strtok_r) merged by hand because I