Fix write() to not assume appending is correct

This commit rewrites the `write()' function to check if it's at EOF
before appending. Now the function is able to prepend if at SOF, and
can also overwrite data in the middle of a stream.
Correct path to clover for Coveralls

It seems php-coveralls will read `build/logs/clover.xml' by default
Use travis-ci.com instead of travis-ci.org