Fixed termination on sentences being repeated out

Found when looking at adding bi-directional capability to tcp sockets: A change a couple of weeks ago caused an issue with repeating sentences without a checksum received over a network connection.

Essentially the code was looking for one of (*\r\n) to terminate the line, advancing 2 chars if "*" (i.e. the checksum case), then appending \r\n, so where no checksum was present, lines ending \r or \r\n would be sent out as \r\r\n, lines ending \n as \n\r\n.

This broke other software which doesn't require a checksum but does require sentences to be terminated with '\r\n' and not contain otherwise illegal characters.

This change has been tested only on Linux but introduces nothing fancy that shouldn't work on any other platform.

As ever, apologies for lack of proficiency with C++ (and therefore questionable style):  I resisted the temptation to do it all with pointers :-)

Looks like there's a bit of optimisation could be done in here but I've gone for fixing with minimal changes first.