I'm continuing to develop an API written in C and wish to share it here.
The API has now been broken out into separate files that can be included thus keeping your main project files small.
Hope someone finds it interesting.
h0rhay.
// ********************************************************************
// readBlock
// ********************************************************************
// READ A BLOCK FROM THE SOCKET.
//
// Read a block of sentences from the socket. Keep reading sentences
// until we encounter !done, !trap or !fatal from the socket.
// If we encounter !trap or !fatal read one additional sentence
// which contains details of the error. In this case it will print
// the block to stdout so you can work on the errors in your code.
Thanks for the info. I'll update the code accordingly. Cheers!Post it to GitHub maybe?
Also, one note based on a skim of the source:A block of sentences can (and sometimes does) contain multiple !trap replies, sometimes one after another. Information about the individual error is not in the next sentence, it's within the same sentence. The only sentences that are meant to be the last sentence per command are !done and !fatal, with !done keeping the connection opened, and !fatal terminating it. In other words, a command that causes an error with produce at least a !trap and a !done sentence, maybe a !trap, another !trap and then a !done sentence.Code: Select all// ******************************************************************** // readBlock // ******************************************************************** // READ A BLOCK FROM THE SOCKET. // // Read a block of sentences from the socket. Keep reading sentences // until we encounter !done, !trap or !fatal from the socket. // If we encounter !trap or !fatal read one additional sentence // which contains details of the error. In this case it will print // the block to stdout so you can work on the errors in your code.