+ stringp = rx_buffer;
+
+ while( ( token = strsep( &stringp, "\n" ) ) != NULL ) {
+
+ /* In case no delimiter was found, the token is taken to
+ be the entire string *stringp, and *stringp is made NULL. */
+ if( stringp == NULL ) {
+ if( token[0] == '\0' ) {
+ /* This means we finished parsing the last line of the buffer, but we need to
+ get more data to continue process the next part of the IMAP4 response. */
+ goto get_packet;
+ }
+ else {
+ /* This should never happen. */
+ ErrorLocation( __FILE__, __LINE__ );
+ fprintf( stderr, " Delimiter not found in strsep() call.\n" );
+ goto error;
+ }
+ }
+
+ if( token == NULL ) {
+ /* This should never happen. */
+ ErrorLocation( __FILE__, __LINE__ );
+ fprintf( stderr, " NULL token returned by strsep().\n" );
+ goto error;
+ }