The getprotoent_r() function is a reentrant version of the getprotoent() function.
The getprotoent_r() function shall search the network protocol database for the next entry.
If the next entry is found in the database, this function shall copy the relevant information to the application-supplied protoent structure referenced by result_buf, and return a pointer to this structure in *result. If no next entry is found, *result shall be set to a null pointer.
The array buf shall contain the string fields referenced by the protoent structure that was returned. The parameter buflen shall specify the array's size. 1024 bytes should be enough for most uses.
On success, the getprotoent_r() function shall return zero.
If the return value was ENOENT, there were no more entries in the database.
If the return value was ERANGE, the size of the buffer buf, indicated by buflen, was too small.