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.)
plot-bamstats: better support for plots of single-read bams
stats: Accept string flags with -f/F
plot-bamstats: Generate summary html page
Ensure installation directories are world-executable

As for installed files, create leaf installation directories
without regard to umask.  (However any parent directories created
via  mkdir -p  will still have umask applied.)
plot-bamstats: Use 0x1 rather than 0x2 flag to detect paired-end

sequencing. Prevent divison by zero with all reads unmapped.
plot-bamstats: fixes in create_html and gz input
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.
Man page minor edit and whitespace canonicalisation
Merge bug fixes for #183 and #262

Also add summary HTML index page.
Use "%s+htslib-%s" version format
Release 0.1.20: final non-htslib standalone samtools