common: write entire string to 'cerr'.

This makes the write atomic, and enables printing messages
from multiple-threads. Or atleast it works better (even if not atomic).
HACKING.md: Add example of clang's static analyzer
src/main.cpp: improve multithreaded code.

Send NULL messages to thread, to signal stop-request.
Then wait for all the threads to join, ensuring output files are
properly generated.
tests: add new test script

To run:
    $ ./tests/runtest.sh

Help screen:
   $ ./tests/runtest.sh -h
HACKING.md: Add examples of tests
Merge pull request #15 from agordon/multithread_bug

Multithread bug