i just said it like 2 times already that i think this destck() and the result serveraddrs() check is bogus and is the source of all this confustion.
the "curdest" is handled as an end pointer in the rest of the code. its where you start adding stuff, and after writing it, you increment it to the next element. so it always points past the last valid element. this is just idiomatic c code. serveraddrs() should take a start index (current count) and return a count. and at the beginning check if the start index is already the maximum size of the dest array. this makes the most sense and is not hard to understand. -- cinap