use BIO_write instead of an unchecked write()

write() warns if its return value is unchecked. Replace with a BIO_write
like all of the surrounding code uses anyway.
do not include public headers as though they are local

Avoid having to use -I trickery to find public header files included as
though they are private.
do not pretend to support -rand in apps

Remove support for parsing the unused -rand option and the unused random
buffer variables.
avoid defining struct pqueue twice

with pqueue moving to an opaque interface, it can be defined twice, which is not allowed
by clang before C00 mode.