Update for htslib API change: hts_open() has only two parameters

Use hts_set_fai_filename() where appropriate.
Add a few comments to bam merging function
WIP on header merging
Add target id translation code and write pseudo code for building RG and PG translation tables
Convert PG and RG pseudo code to working code.
Add pseudocode for PG PP: translation.
Add -D_GNU_SOURCE for some of the newer POSIX functions
Add copyright header
Add code to append SQ tags to header
Fix asprintf format specifiers
Fix bugs picked up by unit testing.
Make trans_tbl_t a named struct and move aside variable names the same as it.
More work on merging @RG and @PG tags into header.
Unit tests for merge
add skeleton code for PP processing
NULLify some freed pointers.
Add tracing statement
Unit test trans_tbl_init add test 5 for PG tags
Fix memory leaks and finalise @PG PP handling
Test @PG merging and PP handling
Integrate new header merging code into bam_sort main function
Clean up old dead code
Fix case where PG or RG tag is present on read but not in header.
Fix translation of tid == -1 aka unmapped.
Sort out extra \n in header text.
Add test bams
Fix spaces to tabs
Eliminate compiler warnings in a cross-platform safe way.
Tweak comments a bit.