/* On an EOF (meaning all the files are at EOF), set *err to 0 and return NULL. */
static merge_in_file_t* merge_append_read_packet(int in_file_count, merge_in_file_t in_files[], int *err, gchar **err_info)
/* On an EOF (meaning all the files are at EOF), set *err to 0 and return NULL. */
static merge_in_file_t* merge_append_read_packet(int in_file_count, merge_in_file_t in_files[], int *err, gchar **err_info)
{
    int i;
    for (i = 0; i < in_file_count; i++) {
        if (in_files[i].state == AT_EOF)
            continue;
        if (wtap_read(in_files[i].wth, err, err_info, &in_files[i].data_offset))
            break;
        if (*err != 0) {
            in_files[i].state = GOT_ERROR;
            return &in_files[i];
        }
        in_files[i].state = AT_EOF;
    }
    if (i == in_file_count) {
        *err = 0;
        return NULL;
    }
    *err = 0;
    return &in_files[i];
}