Raise error if give @HD SO:coordinate to 'samtools fixmate'

The (minimal) documentation does tell you 'samtools fixmate' requires query name
sorted reads (in fact grouped by query name is enough), but doesn't actually raise
an error if given coordinate sorted reads (it just silently fails to fix them).

This change raises an explicit error is the @HD line contains SO:coordinate
Catch overflow in n_cigar and give an explicit error.

Due to the use of an unsigned 16bit integer, BAM
files can only hold reads with up to 65535 CIGAR
operators. SAM does not have this limit, but the
samtools implementation (reasonably) also has the
same 16bit limit.

Prior to this fix a very long CIGAR read would
give a confusing 'unmatched CIGAR operation'
warning and then abort with a core dump.
Don't set text-is-cached flag if reading headers encountered EOF

Only set is_first (i.e., some SAM record text has already been read
in) if a column of the following SAM record has actually been pre-read.
This will not be the case if there are no records at all, only headers.

Fixes #113 (hattip @kmsquire).
Merge pull request #20, fixmate aborts on SO:coordinate
Fix buffer overflow
Remove double fclose()

This fixes issue #47 for the legacy non-HTSlib code branch.
Silence -Wstrict-prototypes warnings in main header files

Fixes issue #45 for the legacy non-HTSlib code branch.
Merge cigar length check (PR #39)

Revise Peter's patch to use parse_error(), as per other CIGAR-related
errors and so that samtools view has a non-zero exit status.
Fix control of compression level in bam_merge_core2

(Fixed on develop by 3ef90e939e170880431b880641034c8d78f885b2.)
Set Git attributes similarly to the develop branch

Mark BAM files (if we add any) as binary and view their diffs as SAM.
Omit control files and README.md from release tarballs.
Release 0.1.20: final non-htslib standalone samtools
Release 1.0: first htslib-based samtools release
Merge version number bump from master branch