ctdl_readline(c, buf, sizeof(buf));
msglist[num_msgs++] = atol(buf);
} while (strcmp(buf, "000")); // this makes the last element a "0" terminator
ctdl_readline(c, buf, sizeof(buf));
msglist[num_msgs++] = atol(buf);
} while (strcmp(buf, "000")); // this makes the last element a "0" terminator