Added more wrappers for functions that make system calls

Added the following wrappers that check the results of system calls
and exit non-zero if something went wrong.  This is so bwa can be more
robust against system failures (e.g. IO errors from remote storage, or
running out of memory).  The existing and new wrappers have also been
modified so that they no longer try to dump core on failure.  In most cases
the resulting core files are not useful (especially if bwa was compiled
with optimization turned on) so just pollute whatever directories they
got written to.

The err_fflush wrapper also now calls fsync on regular files to try to
ensure that data has been written out when using remote filesystems.  This
is not really necessary for local filesystems but only takes a few seconds to
do.  The fsync can be disabled by removing the #define for FSYNC_ON_FLUSH
in utils.c.

Wrappers for memory allocation functions:

xcalloc
xmalloc
xrealloc
xstrdup

New wrappers for IO functions:

err_fwrite
err_fread_noeof   (also dies on EOF)
err_gzread
err_fseek
err_rewind
err_ftell
err_fprintf
err_printf
err_fflush
err_fclose
err_gzclose
Use wrapper functions to catch system errors - io calls

Use the wrapper functions in utils.c plus a few extra bits of error
checking code to catch system errors and exit non-zero when they occur.
This commit mainly covers funtions that make IO system calls.

Updated dependencies in Makefiles.
Use wrapper functions to catch system errors - memory

Use the wrapper functions in utils.c to catch system errors and exit
non-zero when they occur.

This commit adds wrappers for memory allocation functions (malloc, calloc,
realloc and strdup).  It also prevents gen_cigar from trying to realloc a
buffer to zero bytes long.

Updates the dependencies in the Makefile again.
Added wrappers for fputc and fputs; more efficient sequence printing

Added wrappers err_fputc and err_fputs to catch failures in fput and fputs.
Macros err_putchar and err_puts call the new wrappers and can be used in
place of putchar and puts.

To avoid having to make millions of function calls when printing out
sequences, the code to print them in bwa_print_sam1 using putchar has
been replaced by a new version in bwa_print_seq that puts the sequence
into a buffer and then outputs the lot with err_fwrite.  In testing, the
new code was slightly faster than the old version, with the added benefit
that it will stop promptly if IO problems are detected.
Merge pull request #1 from daviesrob/0.5.10-mt_fixes

0.5.10 mt fixes