Implement fiforeset()...and use it to create FIFOs by not closing the passed fd when it is
-1.
To prevent stdin from being closed, we could think about changing
the condition to if(*fd > 0).
Code cleanup...Rename variables to be clearer about what they do, avoid
hungarian notation (namestr -> name).
f->fid was quite confusing (is it the tox-id, id-string or
friendnumber?).
f->num is much clearer. Same applies to all callback-
functions (fid -> frnum).
The separation of Tx and Rx is completed by separating tx-
and rx-state.
Also fixed a strange portion where an active receive-state was
checked by looking at the file-number. use the rxstate for that.