Added CRAM support to htslib and htscmd samview.
This is just a port over from the samtools io_lib subdirectory and has
all the same nasties and duplication of abstract data types.
Merged with attractivechaos/klib:
- add upstream kvsprintf and rework ksprintf
- add upstream printf attribute checks
- use our kputw (has MIN_INT bug fix)
- keep our extra functions (kputc_, kputsn_, kputl)

Added ks_str and ks_len functions for tidier manipulation of
internals.

Added error checking to all functions that allocate memory and could
potentially fail; ie return EOF or negative values as per stdio
equivalents.
Major overhaul of CRAM code (originally imported from Samtools/htlib
branch, and further back from Staden Package io_lib).

All uses of io_lib's HashTable and dstring_t types have been replaced
by khash and kstring.

Renamed io_lib subdir to cram subdir.

Needs exhaustive testing still, but compiles and can encode to and
from CRAM for one small test file.
Merge branch 'develop' of https://github.com/samtools/htslib into develop

Conflicts:
	Makefile
	hts.c
	htslib/Makefile
	sam.c
	samview.c

Added test/test_view.c as a minimal port from the old htscmd view
(samview.c) file.
Further removal of various unusued portions of Staden io_lib.
Switch from modifying CFLAGS to CPPFLAGS so we can do "make CFLAGS=-g".
Bug fix to handle blank headers in SAM files.
Bug fix to stop sam view from converting 'H' into 'Z' types.
Use strtoul instead of strtol for XX:B:I tags so that integers >2.14
billion work.
Better handling of unknown references.
Bug fix to khash-ification of sam_hdr_add_lines
A bit of a hack to set the header and references up properly for
cram. This is a hack right now as it requires accessing internals of
the fp, but it should be fixed in future by properly supporting
methods to manipulate these fields for all data types rather than just
cram (eg see scram.c in io_lib).
Added some synthetic SAM test data and a test perl script to trial
conversion between SAM, BAM and CRAM. A work in progress.
Bug fix to khashification of process_one_read.

(Our CRAM test files now all pass.)
Added tests/test_view
vcf: prevent segfault when sample columns do not exist but FORMAT column does
Merge branch 'develop' of github.com:samtools/htslib into develop
Remove unneeded cast

This cast mainly served only to suppress compiler diagnostics for
various coding mistakes.
On Windows, call knet_win32_init before using knet
Merge branch 'develop' of github.com:samtools/htslib into develop