/* This function parses the responses to the AT~LA and ATS311 commands, which list the radio's neighbours.  */
static void get_radio_neighbours(MetricomNodeTable *table, __u8 *ptr, __u8 *end)
/* This function parses the responses to the AT~LA and ATS311 commands, which list the radio's neighbours.  */
static void get_radio_neighbours(MetricomNodeTable *table, __u8 *ptr, __u8 *end)
{
	table->num_nodes = 0;
	while (ptr < end && table->num_nodes < NODE_TABLE_SIZE) {
		MetricomNode *node = &table->node[table->num_nodes++];
		char *dst = node->c, *limit = dst + sizeof(*node) - 1;
		while (ptr < end && *ptr <= 32)
			ptr++;
		while (ptr < end && dst < limit && *ptr != 10)
			*dst++ = *ptr++;
		*dst++ = 0;
		while (ptr < end && ptr[-1] != 10)
			ptr++;
	}
	do_gettimeofday(&table->timestamp);
}